SSMTP Google Apps

Edit /etc/ssmtp/ssmtp.conf

I found it easiest to comment out all the existing lines in the config and then add the following.  Replacing the capitalized text with your own information.  This works for GMail and Google Apps accounts.

1 mailhub=smtp.gmail.com:587
2 hostname=USER@MYDOMAIN.com
3 root=USER@MYDOMAIN.com
4 AuthUser=USER@MYDOMAIN.com
5 AuthPass=PASSWORD
6 UseSTARTTLS=yes
7 UseTLS=yes
8 FromLineOverride=yes

Edit /etc/ssmtp/revaliases

This file associates the computer’s local user accounts with email accounts that have been defined in the config.  As an example, I’ve defined email for the following two local user accounts (but you’ll want to replace matt with something else):

1 root:USER@MYDOMAIN.com:smtp.gmail.com:587
2 matt:USER@MYDOMAIN.com:smtp.gmail.com:587

Send a Test Email

This is where the revaliases config comes into play.  If you’ve only associated root with an email address then you’ll have to send a test email using the sudo command:

1 sudo ssmtp test@test.com
2 To: Test Guy <test@test.com>
3 From: Me <USER@MYDOMAIN.com>
4 Subject: Hello World
5
6 Hello world!

Note the blank line between subject and body.  Once the body is finished, hit return to advance to the next line and then press CTRL+D to send.

Créditos : http://www.bunkerhollow.com/blogs/matt/archive/2010/10/12/ubuntu-send-email-with-ssmtp-and-google-apps-gmail.aspx

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *