I’ve got “config.action_mailer.delivery_method = :smtp” in my
environment.rb file AND it’s beneath the Rails:: Initializer.run do
|config| line.
At the bottom of the environment.rb file I have:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => “servername.domain.com”,
:port => 25,
:domain => “domain.com”,
:authentication => :login,
:user_name => “login”,
:password => “password”
My order_mailer Controller:
def mail
from “[email protected]”
recipients “[email protected]”
subject “New order to review”
end
My order_mailer/mail View:
Hi,
A new order has been entered. Please review it.
After adding a new order in the order Controller, I have this line near
the bottom of the Create action:
OrderMailer.deliver_mail
After adding an order, the logs reads:
Sent mail:
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Hi,
A new order has been entered. Please review it.
But I never receive the email.
In addition to trying to send email to my business account, I tried
sending to my personal account and to a gmail account. Still no email.
Just for the heck of it, I tried changing the password, and I got a 501
authenication error. So, I can safely say that it’s definitely getting
to the smtp server. I’m not sure how else to troubleshoot this. Any
suggestions?
Hi,
Try adding these to your environment.rb
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.default_charset = “utf-8”
Also check the port for your mail settings.
Neha
On Feb 11, 9:14 am, Denise R. [email protected]
I added those and tried tweaking this and that (again!), but nothing is
different. I still see the email in the log, but it never arrives in an
inbox. Any other thoughts?
Denise,
I didn’t go through your entire post, but this may be of help →
On Feb 11, 11:50 am, Denise R. <rails-mailing-l…@andreas-
Are you sure your port number is correct. If you are using gmail, then
the port should be 587.
Check for the port number.
Else try to get the mail on a different domain name like gmail and
all.
On Feb 11, 11:50 am, Denise R. <rails-mailing-l…@andreas-
ebrad wrote:
This may be of help → #61 Sending Email - RailsCasts
Thanks. I love RailsCasts. I’ll check that out.
you might want to look at this link about gmail specifically and
ActionMailer, since it sounds like your using gmail.
http://www.prestonlee.com/archives/63
Neha C. wrote:
If you are using gmail, then the port should be 587.
Thanks. I didn’t realize that. I know that port is correct for my
personal account, but I didn’t change it for the google account.
Thanks for the advice, everyone.
I ended up deleting everything and then recreating it. And it worked
perfectly.