Mailserver

Aus
Wechseln zu: Navigation, Suche

Mails von der Kommandozeile aus versenden

ssmtp installieren

sudo apt-get install ssmtp

ssmtp konfigurieren

/etc/ssmtp/ssmtp.conf
------------
# The user that gets all the mails (UID < 1000, usually the admin)
root=username@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

# 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=username
AuthPass=password

# Email 'From header's can override the default domain?
FromLineOverride=yes
/etc/ssmtp/revaliases
------------
root:username@gmail.com:smtp.gmail.com:587
mainuser:username@gmail.com:smtp.gmail.com:587

mailutils installieren Mit den mailutils können Mails von der Kommandozeile aus versendet werden.

sudo apt-get install mailutils

Mail versenden

echo test | mail -v -s "testing ssmtp setup" tousername@somedomain.com

Alternativ kann die Mail in eine Textdatei geschrieben und diese versendet werden

test-mail.txt
------------
This is a test body.

Testdatei versenden

mail -s "testin ssmtp with textfile" username@somedomain.com < test-mail.txt

Quelle