Class: Mailhopper::Email
- Inherits:
-
Object
- Object
- Mailhopper::Email
- Includes:
- Mongoid::Document
- Defined in:
- app/models/mailhopper/email.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.create_from_mail(mail) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/models/mailhopper/email.rb', line 24 def create_from_mail(mail) create({ :to_address => address_to_s(mail.to), :from_address => address_to_s(mail.from), :cc_address => address_to_s(mail.cc), :bcc_address => address_to_s(mail.bcc), :reply_to_address => address_to_s(mail.reply_to), :subject => mail.subject, :content => mail.to_s }) end |
Instance Method Details
#send!(delivery_method = nil) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/models/mailhopper/email.rb', line 14 def send!(delivery_method = nil) mail = Mail.new(self.content) mail[:bcc] = self.bcc_address unless self.bcc_address.blank? Base.mailer_class.wrap_delivery_behavior(mail, delivery_method || Base.default_delivery_method) mail.deliver self.sent_at = Time.now self.save! end |