I’ve got a mailer sending through a GMail account, and I want to test that ActionMailer can actually log in to GMail’s SMTP server with the credentials I’ve given it. What’s the best way to test this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s not a full-stack solution, but you can check that the server authentication happens correctly by using Net::SMTP directly. The Mail gem that Rails 3 uses to send ActionMailer emails uses Mail like so (with your ActionMailer.smtp_settings):
Looks like ActionMailer::Base.smtp_settings is accessible too:
Putting that in your test and commenting out the line spoken of above should have a working example for you.