Created
December 17, 2010 12:45
-
-
Save benfoxall/744879 to your computer and use it in GitHub Desktop.
Quick hack to test Rails3 mailers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Mail::Message | |
def dev_deliver(to) | |
@dev_smtp ||= Mail::SMTP.new({ | |
:address => "smtp.gmail.com", | |
:port => 587, | |
:user_name => 'GMAIL-USERNAME', | |
:password => 'GMAIL-PASSWORD', | |
:authentication => 'plain', | |
:enable_starttls_auto => true | |
}); | |
dev_mail = self.dup | |
dev_mail.from = '[email protected]' | |
dev_mail.to = to | |
@dev_smtp.deliver! dev_mail | |
to | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mail(:to => ....).dev_deliver('[email protected]') # will deliver through this mailer to '[email protected]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment