Class: InboxBeam::DeliveryMethod
- Inherits:
-
Object
- Object
- InboxBeam::DeliveryMethod
- Defined in:
- lib/inbox_beam/delivery_method.rb
Overview
Action Mailer delivery method. Instead of sending over SMTP, it appends the rendered message straight into your own mailbox via IMAP APPEND.
config.action_mailer.delivery_method = :inbox_beam
config.action_mailer.inbox_beam_settings = {
host: "imap.gmail.com",
auth: { user: "you@example.com", pass: ENV["IMAP_APP_PASSWORD"] },
mailbox: "INBOX"
}
Existing mailers then land in your inbox with no sending domain, SPF, DKIM, or DMARC. For notifications you read yourself — not for mailing third parties.
Instance Attribute Summary collapse
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Instance Method Summary collapse
- #deliver!(mail) ⇒ Object
-
#initialize(settings = {}) ⇒ DeliveryMethod
constructor
A new instance of DeliveryMethod.
Constructor Details
#initialize(settings = {}) ⇒ DeliveryMethod
Returns a new instance of DeliveryMethod.
21 22 23 |
# File 'lib/inbox_beam/delivery_method.rb', line 21 def initialize(settings = {}) @settings = settings end |
Instance Attribute Details
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
19 20 21 |
# File 'lib/inbox_beam/delivery_method.rb', line 19 def settings @settings end |
Instance Method Details
#deliver!(mail) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/inbox_beam/delivery_method.rb', line 26 def deliver!(mail) opts = settings.dup mailbox = opts.delete(:mailbox) || Client::DEFAULT_MAILBOX unread = opts.key?(:unread) ? opts.delete(:unread) : true Client.new(**opts).append(mailbox, mail.encoded, unread: unread) mail end |