Class: MailerSendActionMailer::DeliveryMethod
- Inherits:
-
Object
- Object
- MailerSendActionMailer::DeliveryMethod
- Defined in:
- lib/mailersend_actionmailer.rb
Defined Under Namespace
Classes: DeliveryError
Constant Summary collapse
- DEFAULTS =
{ }
Instance Attribute Summary collapse
-
#settings ⇒ Object
Returns the value of attribute settings.
Instance Method Summary collapse
- #deliver!(mail) ⇒ Object
-
#initialize(values) ⇒ DeliveryMethod
constructor
A new instance of DeliveryMethod.
Constructor Details
#initialize(values) ⇒ DeliveryMethod
Returns a new instance of DeliveryMethod.
15 16 17 18 |
# File 'lib/mailersend_actionmailer.rb', line 15 def initialize(values) self.settings = self.class::DEFAULTS.merge(values) raise ArgumentError, ":arguments expected to be an Array of individual string args" if settings[:arguments].is_a?(String) end |
Instance Attribute Details
#settings ⇒ Object
Returns the value of attribute settings.
10 11 12 |
# File 'lib/mailersend_actionmailer.rb', line 10 def settings @settings end |
Instance Method Details
#deliver!(mail) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/mailersend_actionmailer.rb', line 20 def deliver!(mail) email = Mailersend::Email.new mail.from.each do |from| email.add_from("email" => from) end mail.to.each do |to| email.add_recipients("email" => to) end email.add_reply_to mail.reply_to email.add_subject mail.subject if mail.mime_type == "text/plain" email.add_text mail.body.raw_source else email.add_html mail.body.raw_source end if mail.cc mail.cc.each do |cc| email.add_cc("email" => cc) end end if mail.bcc mail.bcc.each do |bcc| email.add_bcc("email" => bcc) end end if mail. mail..each do || email. end end email.send end |