Home > database >  Action Mailer not working, cannot figure out why
Action Mailer not working, cannot figure out why

Time:06-02

I am trying to use Action Mailer for the first time and am a student.

I set up AM weeks ago on a project but did not think it was working. Today, I went into the email account attached to AM and saw in the "Sent" folder that AM had sent some messages. I did not realize it was working because I was using fake destination email addresses, and I did not understand that the messages would be visible in the origin email's Sent folder.

I made almost no changes to the project in the weeks since these emails showed up in the sent folder but still AM is not working. In fact, I went back to a commit which was done at the same time that one of these sent emails was delivered, but AM is still not working.

I have gone through the AM docs over and over, they are straight-forward enough, but I have no idea why this isn't working.

When an email is fired off from AM, this is what Terminal spits out. There is no documentation anywhere showing what a successful AM email looks like in terminal, but I'm assuming that this is what it looks like.

My controller

Mailer

development.rb

5.2 Action Mailer Configuration for Gmail says "Action Mailer uses the Mail gem..." I'm not sure if I should add the Mail gem or not, so I've added it and removed it, doesn't seem to matter.

I've put my gmail login credentials directly into the development.rb instead of using ENVs, but this didn't work.

I removed all 2FA from the gmail account, but this didn't work.

Can anyone tell what I"m doing wrong?

CodePudding user response:

You are using delivery_method as sendmail in your development.rb at line 72, but you haven't configured it, that's why you were getting error:

sh: 1: /usr/sbin/sendmail: not found

in your logs.

To configure sendmail for mail setting, please follow config-action-mailer-sendmail-settings.

Otherwise, you can remove line 72 in order to use smtp as delivery method.

  • Related