Mailganer Client
A simple Ruby client for the Mailganer API.\ Designed to make sending requests and integrating with the service effortless.
🚀 Installation
Add this line to your application's Gemfile:
gem "mailganer-client"
Then install:
bundle install
Or install it manually:
gem install mailganer-client
📦 Usage
require "mailganer_client"
MailganerClient.configure do |config|
config.api_key = "your-smtp-api-key",
config.smtp_login = "xxx",
config.api_key_web_portal = "your-web-portal-api-key"
end
client = MailganerClient.new
response = client.send_email(
to: "[email protected]",
from: "[email protected]",
subject: "Hello!",
body: "Your message goes here"
)
puts response
response = client.get_fbl_report_by_date(date_from: "2020-01-01", date_to: "2026-01-01")
puts response
response = client.send_email_smtp_v1(
type: 'template',
to: "[email protected]",
subject: "subject",
template_id: "template_id from mailganer web portal",
params: {
name: 'Test name',
unsubscribeUrl: ''
},
from: "[email protected]",
name_from: "Sender name [email protected]"
)
puts response
#file_path = Rails.root.join('app', 'javascript', 'src', 'public', 'img', 'test-image.jpg')
#file_path = File.expand_path("test-image.jpg", __dir__)
require 'base64'
response = client.send_email_smtp_v1(
type: 'template',
to: "[email protected]",
subject: "subject",
template_id: "template_id from mailganer web portal",
params: {
name: 'Test name'
},
from: "[email protected]",
body: "Hello, {{name}}",
name_from: "Sender name [email protected]",
attach_files: [
{
name: File.basename("file_path"),
filebody: Base64.strict_encode64(File.read("file_path"))
}
]
)
puts response
⚙️ Configuration
MailganerClient.configure do |config|
config.api_key: "your-smtp-api-key",
config.smtp_login: "xxx",
config.api_key_web_portal: "your-web-portal-api-key"
end
## 🏗 Development
``` bash
git clone https://github.com/yetisamurai/mailganer_client.git
cd mailganer_client