Πως να ρυθμίσετε το SSMTP για το yandex και το gmail


Το SSMTP είναι ένα πρόγραμμα που αποστέλλει μηνύματα αλληλογραφίας από ένα τοπικό υπολογιστή σε ένα ρυθμισμένο mailhost (mailhub). Δεν είναι διακομιστής αλληλογραφίας μιας και δεν λαμβάνει αλληλογραφία κλπ. Μια χρήση του είναι η αποστολή αλληλογραφίας αυτόματων μηνυμάτων (όπως ειδοποιήσεις συστήματος) του μηχανήματός σας σε μια εξωτερική διεύθυνση αλληλογραφίας.

Αρχικά εγκαταστήστε τα προγράμματα ssmtp mailutils.
Εγώ το έχω δοκιμάσει με το yandex. Θα αναφέρω και τις ρυθμίσεις για το gmail.

1. Yandex

Αρχικά χρειάζεται ρύθμιση το αρχείο

sudo nano /etc/ssmtp/ssmtp.conf

Το περιεχόμενό του να είναι (αλλάξτε το όνομα_χρήστη και τον κωδικό):

#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=όνομα_χρήστη@yandex.com

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com mailhub=smtp.yandex.ru:465
UseTLS=YES

# Where will the mail seem to come from?
rewriteDomain=yandex.com

# The full hostname
hostname=localhost

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=NO

 #user/pass
AuthUser=όνομα_χρήστη
AuthPass=κωδικός

Επόμενο αλλαγή στο αρχείο

sudo nano /etc/ssmtp/revaliases

Και να περιέχει

# sSMTP aliases
#
# Format: local_account:outgoing_address:mailhub
#
# Example: root:your_login@your.domain:mailhub.your.domain[:port]
# where [:port] is an optional port number that defaults to 25.

#for yandex
root:όνομα_χρήστη@yandex.com:smtp.yandex.com:465
mainuser:όνομα_χρήστη@yandex.com:smtp.yandex.com:465

2. Gmail

Αρχικά χρειάζεται ρύθμιση το αρχείο

sudo nano /etc/ssmtp/ssmtp.conf

Το περιεχόμενό του να είναι (αλλάξτε το όνομα_χρήστη και τον κωδικό):

#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=όνομα_χρήστη@gmail.com

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES

# Where will the mail seem to come from?
rewriteDomain=gmail.com

# The full hostname
hostname=localhost

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=NO

#user/pass
AuthUser=όνομα_χρήστη
AuthPass=κωδικός

Επόμενο αλλαγή στο αρχείο

sudo nano /etc/ssmtp/revaliases

Και να περιέχει

# sSMTP aliases
#
# Format: local_account:outgoing_address:mailhub
#
# Example: root:your_login@your.domain:mailhub.your.domain[:port]
# where [:port] is an optional port number that defaults to 25.

#for gmail
root:όνομα_χρήστη@gmail.com:smtp.gmail.com:587
mainuser:όνομα_χρήστη@gmail.com:smtp.gmail.com:587

Δοκιμάστε να στείλετε ένα mail:

cat > test << "EOF"
To:youraccount@gmail.com
From:όνομα_χρήστη@yandex.com
Subject: Test
This is a test mail.
EOF
ssmtp -t < test

Δεν υπάρχουν σχόλια

Από το Blogger.