您好,我有两个(或以后可能有更多)域:
域1
域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 = : [email protected] : password
domain2_login:
driver = plaintext
public_name = LOGIN1
client_send = : [email protected] : 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
从[email protected]发送电子邮件时,我收到的邮件是[email protected],从[email protected]发送邮件时,我的邮件也是从postmaster @ mg发送的。 domain1.com。
我想为每个具有不同凭据的域提供smarthost。谢谢
最佳答案
我有这些设置(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: [email protected] password=abcdefghi
domain2.com: [email protected] password=jklmnopqr