In a Rails application, I installed a new intermediate environment with the following options in the environments/ file:
config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = true config.action_mailer.delivery_method = :smtp
However, when the system generates an email, it is sent to the staging.log file instead of being sent. My SMTP settings work fine in other environments. What configuration am I missing to send emails?
Edit: Yes, the intermediate window is configured correctly for the SMTP server to which it has access. It seems that the problem is not with the SMTP settings (if it were, would I not get errors in the logs?), But with the Rails configuration. The application still redirects emails to the log file (saying "Sent mail: ..."), as opposed to actually going through SMTP.
Edit # 2: It seems that the letters were indeed sent correctly, they just print in the journal. I am trying to use the sanitize_email stone to redirect mail to a different address, and this does not seem to work, so I thought the emails did not go out. Therefore, I think this solves my problem, although I'm still curious that in the settings, ActionMailer controls whether emails are sent, logged in the log file, or both.
Edit # 3: The problem with sanitize_email was that I needed to add a new staging environment in ActionMailer::Base.local_environments . I will leave this question open to find out if anyone can answer my last question (what determines if ActionMailer emails are sent, are they logged in the log file, or both?)
email ruby-on-rails smtp actionmailer
jrdioko
source share