As of 2016-02-26, there will be no more posts for this blog. s/blog/pba/
Showing posts with label sendmail. Show all posts

I set up SSMTP with Gmail because I wanted to get mails for cron results.

I have these in /etc/ssmtp/ssmtp.conf:

root=<USER>gmail.com
mailhub=smtp.gmail.com:587
#rewriteDomain=
hostname=gmail.com
UseTLS=YES
UseSTARTTLS=YES
AuthMethod=LOGIN
AuthUser=<USER>gmail.com
AuthPass=<SECRET>
FromLineOverride=YES

Make sure this is only root-and-ssmtp-readable.

And /etc/ssmtp/revaliases:

root:<USER>gmail.com:smtp.gmail.com:587
livibetter:<USER>gmail.com:smtp.gmail.com:587

You can test with

echo mailbody | mail -v -s "mail subject" someoneexample.com
echo mailbody | sendmail -v someoneexample.com

I dont have this mail command on my Gentoo, but it seems popular in every page I have read.

If you want to send a more complete test email via sendmail you can

echo -e "Subject: mail subject\nTo: someoneexample.com\n\nmailbody" | sendmail -v someoneexample.com

On Development Server

When I use Mail API with sendmail using the example as in Sending Mail doc, the recipient has to be pure email address:
cannot be
User <[email protected]>
Or sendmail complains:
INFO     2008-10-29 06:57:53,884 mail_stub.py] MailService.Send
INFO     2008-10-29 06:57:53,884 mail_stub.py]   From: [email protected]
INFO     2008-10-29 06:57:53,885 mail_stub.py]   To: User
INFO     2008-10-29 06:57:53,885 mail_stub.py]   Subject: Your account has been approved
INFO     2008-10-29 06:57:53,885 mail_stub.py]   Body:
INFO     2008-10-29 06:57:53,885 mail_stub.py]     Content-type: text/plain
INFO     2008-10-29 06:57:53,885 mail_stub.py]     Data length: 261
/bin/sh: -c: line 0: syntax error near unexpected token `newline'
/bin/sh: -c: line 0: `sendmail User <[email protected]>'
ERROR    2008-10-29 06:57:53,927 mail_stub.py] Error sending mail using sendmail: [Errno 32] Broken pipe
I think this can be fixed by patching the mail_stub.py.

On Production Server

Sender must be:
The sender must be the email address of a registered administrator for the application, or the address of the current signed-in user.