## Config file for sSMTP sendmail## The person who gets all mail for userids < 1000# Make this empty to disable rewriting.root=NoticeFromServer
# The place where the mail goes. The actual machine name is required no # MX records are consulted. Commonly mailhosts are named mail.domain.commailhub=mail.hlmg.tech:465
# Where will the mail seem to come from?rewriteDomain=mail.hlmg.tech
AuthUser=notice@hlmg.tech
AuthPass=xxxxxxxxxxxxxxxxxxxxxxxx
UseTLS=YES
AuthMethod=LOGIN
# The full hostnamehostname=mail.hlmg.tech:465
# Are users allowed to set their own From: address?# YES - Allow the user to specify their own From: address# NO - Use the system generated From: addressFromLineOverride=NO
编辑别名:
1
vim /etc/ssmtp/revaliases
内容如下:
1
2
3
4
5
6
7
# sSMTP aliases# # Format: local_account:outgoing_address:mailhub## Example: root:your_login@your.domain:mailhub.your.domain[:port]# where [:port] is an optional port number that defaults to 25.root:notice@hlmg.tech:mail.hlmg.tech:465
该配置将root用户配置为指定的发件方式。
测试发件
1
2
echo -e "Subject: Test Mail\nThis is the mail body" > /tmp/ssmtp-mail.txt
ssmtp admin@hlmg.tech < /tmp/ssmtp-mail.txt
验证完成后,可通过 mail 命令或者 ssmtp 命令发件:
1
mail -s "Backup successfully" -a "From: Mailu Server Backup <notice@hlmg.tech>" wall@hlmg.tech < daily_backup.log