Sha256: ee44a38308bddb80dfe2490740f3deeb462b1b9bafb3fe646aa30e2c8635f6c8
Contents?: true
Size: 836 Bytes
Versions: 3
Compression:
Stored size: 836 Bytes
Contents
# frozen_string_literal: true require 'base64' module Mailersend # Send an email through MailerSend API class BulkEmail attr_accessor :client, :messages def initialize(client = Mailersend::Client.new) @client = client @messages = [] end def add_attachment(content:, filename:, disposition:) data = File.read(content.to_s) encoded = Base64.strict_encode64(data) @attachments << { 'content' => encoded, 'filename' => filename, 'disposition' => disposition } end def send client.http.post("#{MAILERSEND_API_URL}/bulk-email", json: @messages) end def get_bulk_status(bulk_email_id:) client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/v1/bulk-email/#{bulk_email_id}")) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mailersend-ruby-3.0.0 | lib/mailersend/bulk_email/bulk_email.rb |
mailersend-ruby-2.0.3 | lib/mailersend/bulk_email/bulk_email.rb |
mailersend-ruby-2.0.2 | lib/mailersend/bulk_email/bulk_email.rb |