Debugging Actionmailer
- by Trip
I have actionmailer set up. Emails are not being sent, and no errors.
Where can I start my search to debug this?
class Notifier < ActionMailer::Base
default_url_options[:host] = APP_DOMAIN
def email_blast(user, subject, message)
subject subject
from NOTIFIER_EMAIL
recipients user.email
sent_on Time.zone.now
body :user => user.first_name + ' ' + user.last_name, :message => message
end
I do get a return in my log that the email was sent, just no actual email goes through.
Also the reason, that this is not working is because I switched form a cluster to a solo box and some server settings were overwritten. I suspect that is probably the reason why this is not working. Anyone know what specific server settings I would have to look at ?
UPDATE:
ActionMailer::Base.delivery_method = :sendmail
config.action_mailer.default_url_options = { :host => "75.101.153.93" }
I found this in my production.rb . This code was originally here when it worked. Again, I believe that there must be something missing on my server..I did a 'which sendmail' and it returned /usr/bin/sendmail , so I added this :
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_deliveries = true
config.action_mailer.sendmail_settings = {
:location => '/usr/bin/sendmail',
:arguments => '-i -t'
}
Redeployed, restarted the server, and tested it. No emails were sent.
The production.log said something was sent :
Processing MediaController#create_a_video (for 173.161.167.41 at 2010-06-03 11:58:13) [GET]
Parameters: {"action"=>"create_a_video", "controller"=>"media", "organization_id"=>"470", "_"=>"1275591493194"}
Sent mail to [email protected]
Rendering media/create_a_video
Completed in 128ms (View: 51, DB: 1) | 200 OK [http://invent.hqchannel.com/organizations/470/media/create_a_video?_=1275591493194]