Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Resque job to do the true outbound sending
- class DeliverEmailJob
- include ProjectName::Job::Logging
- @queue = :mail_queue
- def self.perform(args)
- message = QueuedEmail.get!(args["message_id"])
- logger.info("Delivering (%s) to %s" % [message.subject, message.formatted_recipient])
- # This is the important bit, QueueDeliveryMailer rebuilds the email, but overrides the delivery method (see file)
- # Again, using delayed_job, this could be simplified as you could just receive the original Mail::Message
- QueueDeliveryMailer.original_email(message).deliver
- logger.info("Mail delivered to %s" % [message.formatted_recipient])
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement