I was following this tutorial right here
Some additional things that I've noticed is that error seems to stem from whet the @contact.deliver
action is done, I've tried making my own simple mailer in place of using mail_form, and using .deliver_now
triggers the same error, using deliver_later
does not, but the mail never gets sent, so I suspect the error comes from elsewhere.
Any help would be greatly appreciated, as I've reached an impasse regarding this situation
CodePudding user response:
Thanks to the help of the comments, I was able to notice by the line in the heroku logs:
2022-04-28T20:35:32.116916 00:00 app[web.1]: [b1e694c5-cea3-427f-bbdd-aa3cc3a92d6b] Errno::ECONNREFUSED (Connection refused - connect(2) for 127.0.0.1:25):
The port being used was 25
instead of 587
meaning that the block
ActionMailer::Base.smtp_settings = {
:port => ENV['MAILGUN_SMTP_PORT'],
:address => ENV['MAILGUN_SMTP_SERVER'],
:user_name => ENV['MAILGUN_SMTP_LOGIN'],
:password => ENV['MAILGUN_SMTP_PASSWORD'],
:domain => 'https://www.example.com/',
:authentication => :plain,
}
Was being ignored, by instead encompassing those option inside a config.action_mailer.smtp_settings
I was able to resolve the issue.