class Mail::TestMailer
The TestMailer
is a bare bones mailer that does nothing. It is useful when you are testing.
It also provides a template of the minimum methods you require to implement if you want to make a custom mailer for Mail
Attributes
Public Class Methods
Source
# File lib/mail/network/delivery_methods/test_mailer.rb, line 12 def self.deliveries @@deliveries ||= [] end
Provides a store of all the emails sent with the TestMailer
so you can check them.
Source
# File lib/mail/network/delivery_methods/test_mailer.rb, line 27 def self.deliveries=(val) @@deliveries = val end
Allows you to over write the default deliveries store from an array to some other object. If you just want to clear the store, call TestMailer.deliveries
.clear.
If you place another object here, please make sure it responds to:
-
<< (message)
-
clear
-
length
-
size
-
and other common Array methods
Source
# File lib/mail/network/delivery_methods/test_mailer.rb, line 33 def initialize(values) @settings = values.dup end
Public Instance Methods
Source
# File lib/mail/network/delivery_methods/test_mailer.rb, line 37 def deliver!(mail) # Create the envelope to validate it Mail::SmtpEnvelope.new(mail) Mail::TestMailer.deliveries << mail end