sendmail仅发送传出电子邮件的最小设置?

我运行一个简单的服务器,我远程pipe理,我需要它能够发送电子邮件到我的个人电子邮件地址每次出现错误。 使用Ubuntu上的默认设置,sendmail只会在/ var / spool / mail中累积本地发送的电子邮件,但我需要将其发送到外部电子邮件。

我发现的教程都提到将postfix / sendmail设置为一个function齐全的电子邮件服务器,但我只需要外出,而不需要外部login。 有没有一个简单的方法来做到这一点?

如果您需要中继主机并定义它(DSmy.relay.host),您还应该注意

也许nullmailer是给你的。

使用文本编辑器(使用sudo)打开/ etc / aliases并将根行更改为您的电子邮件地址,或者在您的本地用户的左侧添加另一行,并在右侧input您的电子邮件地址:

root: [email protected] 

然后在保存别名文件后,运行newaliases命令:

 $ /usr/bin/newaliases 

sendmail和postfix都被默认configuration为在大多数系统上发送出站邮件。

检查您的服务器是否在端口25(仅限外出)中处于开放状态。 和DNSconfiguration正确。 你不会想发送邮件发送邮件。

以下是有关如何为仅传出设置sendmail的一些详细信息

也在这个页面上

我修改了centos / Amazon Linux网站上列出的步骤。

这里是步骤:

 you may also need to install sendmail-cf # yum install sendmail-cf # cd /etc/mail # nano local-host-names add new line: localhost save the file and quit the editor # make # nano sendmail.mc add these lines above the other FEATURE lines near the top of the file: MASQUERADE_AS(`yourdomain.com')dnl FEATURE(masquerade_envelope) save the file and quit the editor # m4 sendmail.mc > temp.cf # mv temp.cf sendmail.cf # make # /etc/rc.d/init.d/sendmail restart 

假设你实际上在使用postfix。

我将运行dpkg-reconfigure postfix并select“internet site”或“internet with smarthost”(如果要通过智能主机发送邮件)选项作为起点。 这将使您能够发送邮件和从互联网接收邮件。

如果你不希望盒子能够接收邮件,那么我会build议configurationSMTP服务器只在本地主机上侦听。 请参阅https://superuser.com/a/430329/506601