來源
#https://technotim.live/posts/proxmox-alerts/?fbclid=IwY2xjawHzFrBleHRuA2FlbQIxMAABHdkAGaE4zXeT-vDVdc94xwMxPgnF66rx6Irqpz71U4pdbI0_cdUTplKVHQ_aem_5MyfHsJ9-dzlLbGShgH76Q
1.
apt install -y libsasl2-modules mailutils
2.
echo "smtp.gmail.com your-email@gmail.com:YourAppPassword" > /etc/postfix/sasl_passwd
chmod 600 /etc/postfix/sasl_passwd
postmap hash:/etc/postfix/sasl_passwd
3.
nano /etc/postfix/main.cf
# google mail configuration
relayhost = smtp.gmail.com:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/Entrust_Root_Certification_Authority.pem
smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_tls_session_cache
smtp_tls_session_cache_timeout = 3600s
systemctl postfix reload
4.
測試信
echo "This is a test message sent from postfix on my Proxmox Server" | mail -s "Test Email from Proxmox" your-email@gmail.com
#修改信件抬頭
1.
apt install postfix-pcre
2.
vi /etc/postfix/smtp_header_checks
/^From:.*/ REPLACE From: pve1-alert
vi /etc/postfix/main.cf
smtp_header_checks = pcre:/etc/postfix/smtp_header_checks
systemctl postfix reload