## 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=[email protected]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:[email protected]:mailhub.your.domain[:port]# where [:port] is an optional port number that defaults to 25.root:[email protected]:mail.hlmg.tech:465
该配置将root用户配置为指定的发件方式。
测试发件
1
2
echo -e "Subject: Test Mail\nThis is the mail body" > /tmp/ssmtp-mail.txt
ssmtp [email protected] < /tmp/ssmtp-mail.txt