Postfix
Aliases
The aliases are grouped in /etc/aliases
# See man 5 aliases for format
postmaster: root
root: me@mydomain.org
leopardb: me@mydomain.org
After modifying, do not forget to run newaliases
Test email one liner
Using sendmail
, root email address in /etc/aliases
echo -e "Subject:Test - delete me\n\nPing\n" | sendmail root
echo -e "To:leo@domain.com\nSubject:Test - delete me\n\nPing\n" | sendmail root
echo -e "From:authorized@domain.com\nTo:leo@domain.com\nSubject:Test - delete me\n\nPing\n" | sendmail root
(echo -e "Subject:Test - delete me\n\nPing\n"; dmidecode ) | sendmail root
Omitting the To: will make the email appear as sent to “undisclosed recipients”.
Authentication
You must have installed the required SASL libraries:
apt install libsasl2-modules
Create a password file sasl_passwd
looking like this:
external.smtpserver.com:25 login:password
the server part has to be written exactly as it appears in main.cf
Protect it:
chown root:root sasl_passwd
chmod 600 sasl_passwd
Create the hash:
postmap sasl_passwd
Mail queue
List emails in the queue
sendmail -bp
Remove emails in queue (postsuper – Postfix superintendent):
postsuper -d mail_id
postsuper -d ALL
Relay
To relay mail for other clients from the network 192.168.0.0/24
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.0.0/24
inet_interfaces = all
inet_protocols = ipv4