sudo hostnamectl set-hostname example.com
sudo apt install mailutils postfix
mail your-test@yopmail.com -s "Subject"
debian@example.com
sudo apt install certbot
sudo certbot certonly --standalone --rsa-key-size 4096 --agree-tos --preferred-challenges http -d example.com
sudo chown -R root:postfix /etc/letsencrypt/live/example.com
/etc/postfix/main.cf
# TLS parameters
smtpd_tls_cert_file=/etc/letsencrypt/live/example.com/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/example.com/privkey.pem
smtp_use_tls=yes
v=spf1 ip4:<your_ipv4> ~all
v=DMARC1;p=none;pct=100;rua=yourmail@example.com;sp=none;aspf=r;
/etc/postfix/master.cf
smtpd_sasl_type=dovecot
by smtpd_sasl_type=cyrus
-o smtpd_sasl_security_options=noanonymous
sudo apt install sasl2-bin
sudo usermod -aG sasl postfix
/etc/default/saslauthd
START=yes
MECHANISMS="sasldb"
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd"
sudo systemctl restart saslauthd
systemctl status saslauthd
/var/spool
argumentssudo saslpasswd2 -c -u example.com user
sudo testsaslauthd -u user -p password -f /var/spool/postfix/var/run/saslauthd/mux
/etc/postfix/sasl/smtpd.conf
pwcheck_method: saslauthd
mech_list: PLAIN LOGIN
sudo postfix reload
npx ts-node test.ts
import nodemailer from 'nodemailer';
const smtpEndpoint = 'example.com';
const port = 587;
const senderAddress = 'My name <my-address@example.com>';
const smtpUsername = 'user';
const smtpPassword = 'pass';
const transport = nodemailer.createTransport({
host: smtpEndpoint,
port: port,
secure: false,
auth: { user: smtpUsername, pass: smtpPassword }
});
transport.sendMail({
from: senderAddress,
to: 'your-mail-tester-addr',
subject: 'A real subject',
text: 'A real body'
});
/etc/postfix/main.cf
virtual_alias_maps = hash:/etc/postfix/virtual
/etc/postfix/virtual
@example.com debian
sudo postmap /etc/postfix/virtual
mail
and confirm IP’s ownershiptail -f /var/log/mail.info
-v
in submission parameters (/etc/postfix/master.cf
)