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?
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!
If you remove the “–from=default” it should work. This is because:
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.