Skip to content

Instantly share code, notes, and snippets.

@benfoxall
Created December 17, 2010 12:45
Show Gist options
  • Save benfoxall/744879 to your computer and use it in GitHub Desktop.
Save benfoxall/744879 to your computer and use it in GitHub Desktop.
Quick hack to test Rails3 mailers.
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
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