Um Emails von meinem Linux-NAS zu verschicken verwende ich programm ssmtp:

sSMTP is a simple MTA to deliver mail from a computer to a mail hub (SMTP server). sSMTP is simple and lightweight, there are no daemons or anything hogging up CPU; Just sSMTP. Unlike Exim4, sSMTP does not receive mail, expand aliases, or manage a queue.

Ich habe es für Gmail-Versand eingerichtet:

cat /etc/ssmtp/ssmtp.conf

# The user that gets all the mails (UID < 1000, usually the admin)
root=BENUTZERNAME@gmail.com

# The mail server (where the mail is sent to), both port 465 or 587 should be acceptable
# See also http://mail.google.com/support/bin/answer.py?answer=78799
# mailhub=smtp.gmail.com:587
mailhub=smtp.gmail.com:587

# The address where the mail appears to come from for user authentication.
rewriteDomain=gmail.com

# The full hostname
hostname=localhost

# Use SSL/TLS before starting negotiation
UseTLS=Yes
UseSTARTTLS=Yes

# Username/Password
AuthUser=HIER_BENUTZERNAME_VON_GMAIL
AuthPass=HIER_PASSWORT_VON_GMAIL

# Email 'From header's can override the default domain?
FromLineOverride=YES

WICHTIG: Passwort wird unverschlüsselt gespeichert, deshalb richtige Dateirechte setzen:

chown root:mail /etc/ssmtp/ssmtp.conf
# chmod 640 /etc/ssmtp/ssmtp.conf

Jetzt müssen nur noch Linux-Benutzer mit Emailadressen verknüpft werden:

cat /etc/ssmtp/revaliases

root:BENUTZERNAME@gmail.com:smtp.gmail.com:587
www-data:BENUTZERNAME@gmail.com:smtp.gmail.com:587
username:BENUTZERNAME@gmail.com:smtp.gmail.com:587

Nach restart von dem ssmtp-Dienst kann das Senden getestet werden:

ssmtp "testing ssmtp setup" yourMail@gmail.com

Share me

Share to Google Buzz
Share to Google Plus
Share to LiveJournal
Share to MyWorld
Share to Odnoklassniki