Debian e derivati usano di default Exim4 come mail server. Per chi usa Gmail, si possono spedire messaggi usando l’smtp di Google. Ecco come fare.
# dpkg-reconfigure exim4-config
- Scegliere SI, dividi la configurazione in piccoli file
- Scergliere spedizione con SMARTHOST; ricezione con SMTP o fetchmail
- Scrivi il dominio del tuo server mail: e.g. company.com
- Scrivi l’indirizzo IP su cui ascoltare connessioni SMTP: 127.0.0.1
- Lasciare vuoto il campo altre destinazioni da cui accettare email
- Lasciare vuoto il campo relay
- Inserire l’host dell’smtp da usare (smarthost): smtp.gmail.com::587
- Scegliere NO, non nascondere l’host locale per la posta spedita.
- Scegliere NO, non limitare le richieste al DNS al minimo (dial-on-demand)
Lanciare:
# editor /etc/exim4/passwd.client
e aggiungere le seguenti righe:
*.google.com:yourAccountName@gmail.com:y0uRpaSsw0RD
# chown root:Debian-exim /etc/exim4/passwd.client
Ecco come funziona /etc/exim4/passwd.client: il primo campo viene matchato con il reverse DNS lookup del server smtp remoto (in questo caso GMail). In pratica, Exim chiede al DNS l’IP di smtp.gmail.com, e fa un reverse DNS per recuperare il dominio (come scrivere “$ host smtp.gmail.com”). Se il dominio (o semplicemente l’IP se non è stato configurato il reverse DNS) matcha con il primo campo del file, allora prova ad autenticarsi con login / password.
A questo punto lanciare:
# update-exim4.conf
Buona fortuna.
Possibili Problemi (che strano…)
Se non succede nulla, controlla il file /etc/exim4/exim4.conf.
Exim will use this file if it exists and ignore the autogenerated one, see UPDATE-EXIM4.CONF(8).
You’d may rename this file to enable /var/lib/exim4/config.autogenerated and see what effect this may have. But you should check where this file has come from and contact its originator(s).
If this doesn’t work, first enable POP for your GMail account, and then try:
# tail /var/log/exim4/mainlog.
If you see something like
-
2005-10-23 21:51:04 1ETuIW-0002iB-Qo ** yourAccountName@gmail.com R=smarthost T=remote_smtp_smarthost: SMTP error from remote mailer after MAIL FROM:<yourAccountName@gmail.com> SIZE=1555: host gmail-smtp.l.google.com [64.233.163.111]: 530 5.7.0 Authentication Required 23sm863650nzn
except there is something different than
gmail-smtp.l.google.com,
the host might be resolving to something else. In that case, replace the gmail-smtp.l.google.com in your /etc/exim4/passwd.client with whatever it says.
To try test these changes immediately—you might have failed enough times to have a very long delay between retries—run
# exim4 -M 1ETuIW-0002iB-Qo
-
or
# exim -v -M 1K3x0N-0000cb-Fq 2>&1 | less
but replacing that garbage ID tag from the first line of the error entry in the log file with the ID of the failed message that you want to resend.
exim4 4.62-2, the default version for ubuntu Edgy has authentication problems. Bug report 403583 shows required changes to the hosts_try_auth clause of /etc/exim4/conf.d/transport/30_exim4-config_remote_smtp_smarthost.
If you see something like
failed to open /etc/exim4/passwd.client for linear search: Permission denied (euid=102 egid=102)
exim is unable to read the password file.
The following will restore the default permissions.
{{{# chown root:Debian-exim /etc/exim4/passwd.client # chmod 640 /etc/exim4/passwd.client}}}
If you see in mainlog message that states “Credentials Rejected”, type:
# vi /etc/exim4/passwd.client
and replace every yourAccountName@gmail.com with yourAccountName (delete @gmail).