January 22nd 2018
My server is running debian jessie.
Recently I had been messing around with different mailing setups, which resulted in total breakage of email sending, as sometimes required by some software, usually via
First of all I purged all packages, like dovecot and exim4, and always performed an
"apt-get --purge autoremove" afterwards.
Then I had to go through all the leftover configuration & modifications in /etc. There was a lot of it, even after purging the packages.
With a hopefully clean system, install ssmtp and mailutils:
apt-get install ssmtp mailutils.
Configuration for Gmail:
- activate 'allow less secure apps' from your gmail profile
/etc/ssmtp/ssmtp.confshould look like this:
email@example.com mailhub=smtp.gmail.com:587 rewriteDomain=nn.nn.nn.nn (my IP) hostname=nn.nn.nn.nn FromLineOverride=YES UseTLS=YES UseSTARTTLS=YES AuthUserfirstname.lastname@example.org AuthPass=verysecret AuthMethod=LOGIN
Configuration for other Picky Email Provider
I had to
- use STARTTLS, and port 587 (instead of 465 for TLS)
- set up rewriting in both
/etc/ssmtp/revaliasesfor root and normal user:
# /etc/ssmtp/ssmtp.conf: email@example.com firstname.lastname@example.org # /etc/ssmtp/revaliases: root:email@example.com:smtp.posteo.de:587 username:firstname.lastname@example.org:smtp.posteo.de:587
...maybe that wasn't really necessary, but often it seems to be important that th from addresses matches that of the actual email account used.
- Fix permissions on /etc/ssmtp/ssmtp.conf etc. as outlined here (also for /etc/ssmtp/revaliases, see below).
- I also had to write a custom script for