我试图通过给我发电子邮件来完成我的Nagios安装。 它使用/ bin / mail给我发电子邮件,所以它总是被发送到我的垃圾邮件文件夹。 我安装了sSMTP,试图发送一个请求到我的作品的电子邮件服务器,以便能够从一个经过validation的用户发出一条消息。
这是我的/etc/ssmtp/ssmtp.conf文件:
mailhub=10.200.120.148:25 UseTLS=NO AuthUser= [email protected] AuthPass=PASSWORD
到目前为止,我一直在使用下面的命令,它仍然以root @ localhost的身份到达我的电子邮件收件箱,这会导致它进入我的垃圾邮件文件夹(除了我有一个电子邮件提供程序)。
cat message |ssmtp [email protected]
我在网上看了几个例子,他们似乎都和我差不多。 有人看到我犯的错误吗?
只是澄清,[email protected]是我的工作使用的邮件服务器上的用户。
我开始发送消息,同时运行tcpdump -A port 25并观看SMTP对话。
如果远程邮件系统显示邮件正在排队,那么sSMTP工作正常,您必须查看远程邮件服务器。 如果它没有说它是排队的,那就试着修正它说的错误。
如果你没有看到任何连接,那么问题出在sSMTP上。
好的,我能够得到它的工作,所以这里有一些文件给其他可能有类似问题的人:
这里是vim /etc/ssmtp/ssmtp.conf文件:
# Email address the mail is sent from (account created on the SMTP server) [email protected] # IP-address of the mail server mailhub=10.200.120.148:25 # Domain of the mail server RewriteDomain=domain.com # Local machine's name Hostname=nagios.localdomain FromLineOverride=YES UseTLS=NO # Email account and password [email protected] AuthPass=password
为了使用这个,我运行下面的命令:(确保不要在下面的命令\ n之后放置空格)
echo -e "To: [email protected]\nFrom: [email protected]\nSubject: Nagios Notification\n\n Hello, this is a test"|ssmtp [email protected]
这导致我的Gmail帐户收到从[email protected]发送的电子邮件,而不是在垃圾邮件文件夹中结束。
感谢你的帮助