为 CentOS, Plesk 和 Postfix 配置服务器端电子邮件发送服务
使用以下步骤配置服务器,以便将 SendGrid 电子邮件传送服务 IBM Cloud® 作为智能主机使用。
以下示例是具有 Plesk 12 和 Postfix 的标准 IBM Cloud® 操作系统重装 CentOS 6.5。 note}
配置
-
找到 Postfix 配置文件。 公共位置为
/etc/postfix/main.cf
。 -
用文本编辑器打开 main.cf 文件,在配置中添加以下内容。
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:_Your SendGrid Username_:_Your SendGrid Password_
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
header_size_limit = 4096000
relayhost = [smtp.sendgrid.net]:587
-
保存并关闭 /etc/postfix/main.cf 文件。
-
使用此命令重新启动 Postfix:
/etc/init.d/postfix restart
故障诊断
-
如果出现“无可用机制”的错误,请检查是否拥有所有必要的身份验证或加密库。 您可以使用以下命令安装这些库:
对于 Debian 和 Ubuntu,请使用以下命令:
apt-get install libsasl2-modules
对于 Red Hat 和 CentOS, 使用此命令:
yum install cyrus-sasl-plain
安装这些库后,请使用相同的重启命令:
/etc/init.d/postfix restart
-
如果端口 587 不好用,请在 Postfix 配置中使用端口 2525。 您可能还需要打开配置文件
/etc/postfix/main.cf
,并取消对下面一行的注释:#tlsmgr unix - - n 1000? 1 tlsmgr