我想设置某种邮件服务器来将电子邮件从我的 gmail 帐户发送到另一封电子邮件。我怎样才能做到这一点?
首先,安装 sSMTP,因为在这种情况下 postfix 是矫枉过正的。是的,这将删除后缀。我们关心吗?并不真地。
sudo apt-get install ssmtp
Run Code Online (Sandbox Code Playgroud)
/etc/ssmtp/ssmtp.conf
Run Code Online (Sandbox Code Playgroud)#Config file for sSMTP sendmail # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=yourusername@gmail.com #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 AuthUser=yourusername@gmail.com 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
Run Code Online (Sandbox Code Playgroud)
重新启动 nagios,你应该设置好了。
sudo service nagios3 restart
Run Code Online (Sandbox Code Playgroud)