具有不同凭据的不同域的不同智能主机

时间:2016-02-05 00:16:40

标签: cpanel sendgrid mailgun exim

您好我有两个(或者更晚一些)域:

domain1的 域2

我想将Exim(cPanel)配置为使用SendGrid或Mailgun SMTP服务器,目前我正在尝试在Exim中使用此配置:

**Section: TRANSPORTSTART**
domain1_smtp:
driver = smtp
hosts = smtp.mailgun.org
hosts_require_auth = smtp.mailgun.org
hosts_require_tls = smtp.mailgun.org

domain2_smtp:
driver = smtp
hosts = smtp.mailgun.org
hosts_require_auth = smtp.mailgun.org
hosts_require_tls = smtp.mailgun.org


**Section: AUTH**
domain1_login:
driver = plaintext
public_name = LOGIN
client_send = : postmaster@mg.domain1.com : password

domain2_login:
driver = plaintext
public_name = LOGIN1
client_send = : postmaster@mg.domain2.com : password

**Section: PREROUTER**
send_via_domain1:
driver = manualroute
domains = ! +local_domains
senders = *@domain1.cm
transport = domain1_smtp
route_list = "* smtp.mailgun.org::2525 byname"
host_find_failed = defer

send_via_domain2:
driver = manualroute
domains = ! +local_domains
senders = *@domain2.com
transport = domain2_smtp
route_list = "* smtp.mailgun.org::2525 byname"
host_find_failed = defer

当我从user@domain1.com发送电子邮件时,我收到了postmaster@mg.domain1.com发送的消息,当我从user@domain2.com发送消息时,我也收到了来自postmaster的消息@ mg.domain1.com。

我想为每个具有不同凭据的域提供smarthost。感谢

1 个答案:

答案 0 :(得分:1)

我有这些设置(VPS + WHM / cPanel + Exim + Mailgun),在进行了一些在线研究之后,我发现了一些与该主题有关的有用网站,并设法进行了正确的配置。以下是我目前在VPS上使用的解决方案,希望对您有所帮助。它应该可以解决您的“通过”问题,也可以解决来自Mailgun的间歇性“ 550 5.7.1拒绝中继”错误:



转到WHM中的“ Exim配置编辑器”。选择“高级编辑器”,然后在下面插入配置:



部分:AUTH

mailgun_login:
driver = plaintext
public_name = LOGIN
hide client_send = ": ${extract{login}{${lookup{$sender_address_domain}lsearch{/etc/exim_mailgun}{$value}fail}}} : ${extract{password}{${lookup{$sender_address_domain}lsearch{/etc/exim_mailgun}{$value}fail}}}"



部分:ROUTERSTART

mailgun:
driver = manualroute
domains = ! +local_domains
transport = mailgun_transport
route_list = "* smtp.mailgun.org::587 byname"
host_find_failed = defer
no_more



部分:TRANSPORTSTART

mailgun_transport:
driver = smtp
hosts = smtp.mailgun.org
hosts_require_auth = smtp.mailgun.org
hosts_require_tls = smtp.mailgun.org



然后创建一个名为/ etc / exim_mailgun的文件,并插入类似于以下结构的内容(将其替换为已验证的Mailgun的域登录凭据):

domain1.com:    username=postmaster@mg.domain1.com     password=abcdefghi
domain2.com:    username=postmaster@mg.domain2.com     password=jklmnopqr