Class: Moogle::Commands::PushEmail
- Inherits:
-
Object
- Object
- Moogle::Commands::PushEmail
- Includes:
- Serf::Command
- Defined in:
- lib/moogle/commands/push_email.rb
Overview
Sends an email
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
18 19 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 |
# File 'lib/moogle/commands/push_email.rb', line 18 def call mail_class = opts :mail_class, Mail # Create the mail object to send, get a local var 'req' so it is # visible inside the proc. req = request mail = mail_class.new do to req.to from req.from subject req.subject text_part do body req.text_body end if req.html_body html_part do content_type req.html_content_type body req.html_body end end end # Tags for postmark if mail.respond_to?(:tag=) && !request.categories.blank? mail.tag = request.categories.sort.join ', ' end # Deliver the mail using the default mailer delivery settings mail.deliver! # Return an event representing this action. event_class = opts :event_class, Moogle::Events::EmailPushed return event_class.new( request.create_child_uuids.merge( message_origin: request., target_id: request.target_id, request: request)) end |