![我怎样才能将 nagios 警报通过电子邮件发送到我的 Gmail?](https://linux22.com/image/1077902/%E6%88%91%E6%80%8E%E6%A0%B7%E6%89%8D%E8%83%BD%E5%B0%86%20nagios%20%E8%AD%A6%E6%8A%A5%E9%80%9A%E8%BF%87%E7%94%B5%E5%AD%90%E9%82%AE%E4%BB%B6%E5%8F%91%E9%80%81%E5%88%B0%E6%88%91%E7%9A%84%20Gmail%EF%BC%9F.png)
我想设置某种邮件服务器,以便将电子邮件从我的 Gmail 帐户发送到另一个电子邮件帐户。我该怎么做?
答案1
首先,安装 sSMTP,因为在这种情况下,postfix 有点多余。是的,这将删除 postfix。我们关心吗?其实不关心。
sudo apt-get install ssmtp
- 通过编辑配置 sSMTP
/etc/ssmtp/ssmtp.conf
#Config file for sSMTP sendmail # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. [email protected] #I recommend setting this mailhub=smtp.gmail.com:587 # Where will the mail seem to come from? rewriteDomain= #The full hostname hostname=[some hostname here] UseTLS=YES UseSTARTTLS=YES AuthMethod=LOGIN [email protected] AuthPass=yourpassword # 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 # This is optional if you're going to use revaliases - I didn't FromLineOverride=YES
现在,我们需要设置/etc/ssmtp/ssmtp.conf
权限帮助(它不是万无一失的)保护您的明文密码。
sudo chown root:nagios /etc/ssmtp/ssmtp.conf
sudo chmod 640 /etc/ssmtp/ssmtp.conf
重新启动 nagios 然后就设置好了。
sudo service nagios3 restart