使用 ssmtp 向系统用户发送电子邮件的设置在哪里?

Mic*_*hel 7 email ssmtp

ssmtp用于发送电子邮件(设置如下)

现在,当我运行cron命令或at命令时,邮件被发送到

michel@mypi
Run Code Online (Sandbox Code Playgroud)

这是 username @ machinename

现在当然这不是一个有效的电子邮件地址,所以我在我的 gmail 中收到错误消息: can't send email to michel@mypi

我应该如何以及在哪里说给用户“michel”的电子邮件应该转到特定的电子邮件地址?

ssmtp 的设置:

#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000 # Make this empty to disable rewriting.
root=MYNAME@gmail.com

# The place where the mail goes. The actual machine name is required no 
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:465

# Where will the mail seem to come from?
#rewriteDomain=gmail.com

# The full hostname
hostname=MyPi

# 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: address 
#FromLineOverride=YES 
AuthUser=MYNAME
AuthPass=MYPASS
FromLineOverride=YES
UseTLS=YES
Run Code Online (Sandbox Code Playgroud)

she*_*n89 10

很抱歉让死者复活,但我通过谷歌偶然发现了这个问题并且刚刚解决了它:/etc/ssmtp/realiases 只是 FROM: 地址的别名。

TO: 地址的别名通常需要在 /etc/aliases 中设置,但 SSMTP 不会读取此内容!相反,您需要编辑 /etc/mail.rc 并添加一行,例如

alias root root<yourname@youremail.com>
Run Code Online (Sandbox Code Playgroud)

有关更多信息,请参阅http://possiblelossofprecision.net/?p=591

更新 2019-05-07 - 根据下面的评论,现在在 EPEL 中的软件包的更高版本(如果您使用的是 RedHat 系列发行版)现在可以读取该/etc/aliases文件,因此请检查您的版本!


Jen*_*y D 1

使用文件 /etc/ssmtp/revaliases 输入您的别名,例如

michel:username@gmail.com:smtp.gmail.com:465
Run Code Online (Sandbox Code Playgroud)