I am sending mails using actionmailer and using gmail with the following configuration
In Notifier.rb
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
# :domain => I18n.translate('notifier.domain'),
:domain => 'gmail.com',
:user_name => '[email protected]'
:password => "xxx",
:authentication => :plain,
:enable_starttls_auto => true
}
def activation_instructions(user)
logger.debug "delivering activation instructions to #{user.email}"
subject 'Website Activation'
from '[email protected]'
recipients user.email
sent_on Time.now
body :account_activation_url => register_url(user.perishable_token)
end
This works fine i.e. an email is delivered to the user's email address, when I run it from script/console but when this is delivered via a delayed_job send_later method call (which succeeds, the job goes on without any errors) as part of the registration process, it doesn't. This only happens in production, the same code works just fine in development. I don't see any delivery errors either.