diff options
author | George Claghorn <george@basecamp.com> | 2018-12-27 21:15:10 -0500 |
---|---|---|
committer | George Claghorn <george@basecamp.com> | 2018-12-27 21:17:58 -0500 |
commit | e3f832a7433a291a51c5df397dc3dd654c1858cb (patch) | |
tree | 3137f4fcdd79768e24e1a6778a1cc5ae1c9e74de /actionmailer/README.rdoc | |
parent | 22a6ff68b1264de693364dd89be651dda9626284 (diff) | |
download | rails-e3f832a7433a291a51c5df397dc3dd654c1858cb.tar.gz rails-e3f832a7433a291a51c5df397dc3dd654c1858cb.tar.bz2 rails-e3f832a7433a291a51c5df397dc3dd654c1858cb.zip |
Deprecate ActionMailer::Base.receive in favor of Action Mailbox
Diffstat (limited to 'actionmailer/README.rdoc')
-rw-r--r-- | actionmailer/README.rdoc | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/actionmailer/README.rdoc b/actionmailer/README.rdoc index 14dfb82234..74d7ea65ce 100644 --- a/actionmailer/README.rdoc +++ b/actionmailer/README.rdoc @@ -93,42 +93,6 @@ Example: ..... end -== Receiving emails - -To receive emails, you need to implement a public instance method called -+receive+ that takes an email object as its single parameter. The Action Mailer -framework has a corresponding class method, which is also called +receive+, that -accepts a raw, unprocessed email as a string, which it then turns into the email -object and calls the receive instance method. - -Example: - - class Mailman < ActionMailer::Base - def receive(email) - page = Page.find_by(address: email.to.first) - page.emails.create( - subject: email.subject, body: email.body - ) - - if email.has_attachments? - email.attachments.each do |attachment| - page.attachments.create({ - file: attachment, description: email.subject - }) - end - end - end - end - -This Mailman can be the target for Postfix or other MTAs. In Rails, you would use -the runner in the trivial case like this: - - rails runner 'Mailman.receive(STDIN.read)' - -However, invoking Rails in the runner for each mail to be received is very -resource intensive. A single instance of Rails should be run within a daemon, if -it is going to process more than just a limited amount of email. - == Configuration The Base class has the full list of configuration options. Here's an example: |