- Published on
从命令行里发邮件
- Authors
- Name
- wellsleep (Liu Zheng)
# apt install mailutils
$ mail -s "*title*" *target_addr* -r *sender_addr* <<< "*content*"
如果是发送到垃圾QQ系邮箱,由于系统无法认出 abc@def 这种非正常域名格式的发件人,会无法加入到白名单,所以需要修改
# vi /etc/postfix/main.cf
在其中把 myhostname
修改为 sender_addr 的@域名后缀,再加一个 mail_name 的值。这样在QQ系邮箱中就可以添加到发件白名单了……
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = esD-0.localhost.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, esD-0, localhost.localdomain, , localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
mail_name = zliu@esD-0.localhost.com
其他tip:
# vi /var/log/mail.log
可以查看发送邮件过程中的log信息