class method self.receive

Ruby on Rails 5.2.8.1

Since v2.2.3 Last seen in v6.0.6

Available in: v2.2.3 v2.3.18 v3.0.20 v3.1.12 v3.2.22.5 v4.0.13 v4.1.16 v4.2.9 v5.2.8.1 v6.0.6

Signature

self.receive(raw_mail)

Receives a raw email, parses it into an email object, decodes it, instantiates a new mailer, and passes the email object to the mailer object’s receive method.

If you want your mailer to be able to process incoming messages, you’ll need to implement a receive method that accepts the raw email string as a parameter:

class MyMailer < ActionMailer::Base
  def receive(mail)
    # ...
  end
end

Parameters

raw_mail req
Source
# File actionmailer/lib/action_mailer/base.rb, line 543
      def receive(raw_mail)
        ActiveSupport::Notifications.instrument("receive.action_mailer") do |payload|
          mail = Mail.new(raw_mail)
          set_payload_for_mail(payload, mail)
          new.receive(mail)
        end
      end

Defined in actionmailer/lib/action_mailer/base.rb line 543 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionMailer::Base

Type at least 2 characters to search.

↑↓ navigate · open · esc close