Question

MSMTP says the email is queued but never get's sent

I installed MSMTP as my mail client on my Ubuntu LAMP on 14.04 droplet. I followed a tutorial and managed to get PHP using it to send mail. Testing via Wordpress works beautifully.

I’ve got it setup to use Mandrill to send mail. I can view the Mandrill logs as well as the Droplet logs at /var/log/msmtp.log.

Now I’m trying to get cron to use msmtp to send it’s notifications. The first step was to verify my user could send mail via the command line. Well, that’s where I’ve got stuck. Using this command:

echo -e "Subject: Test Mail\r\n\r\nThis is a test mail" | msmtp --debug --from=default -t myemail@gmail.com

I see the log come into my msmtp.log file, and everything is reported as OK. I even get a queued number, something like:

Dec 31 03:56:50 host=smtp.mandrillapp.com tls=on auth=on user=joel@domain.com from=default recipients=myemail@gmail.com mailsize=40 smtpstatus=250 smtpmsg='250 2.0.0 Ok: queued as E467F1C02F5' exitcode=EX_OK

But this never get’s to Mandrill. Well from what I can tell it doesn’t.

Can anyone help me get through the first step of sending mail from the cmd line?

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

If you remove the “–from=default” it should work. This is because:

  1. The receiving smtp server is rejecting the “default” address from the command line.
  2. Even though you remove the “–from=default” msmtp will read the default block (if you don’t specify any) from the user (or system) config.

If you go into the API Logs on mandrill’s web site and search for “Mandrill-Python” you will see only the SMTP messages in the API Log.

looking at the Full Response section will give you some clues. When I was struggling with this I was seeing an error like this:

    "reject_reason": "invalid-sender"

Make sure you include the from address as the first line of your mail message.

echo -e "From:example@example.com\r\nSubject: Test Mail\r\n\r\nThis is a test mail" | msmtp --debug --from=default -t myemail@gmail.com