在基于 PHP 的 SMTP 客户端中设置 DomainKeys/DKIM

2022-01-17 00:00:00 smtp php email-spam dkim domainkeys

看起来有一些很棒的库可以在 C#/.NET 上对电子邮件进行 DomainKeys 签名,但我很难找到对 PHP 的相同类型的支持.也许我没有找对地方?

It looks like there are some great libraries out there to do DomainKeys signing of emails on C#/.NET, but I'm having a really hard time finding the same kind of support for PHP. Maybe I'm not looking in the right place?

我找到的唯一一个是 http://php-dkim.sourceforge.net/;它看起来非常h​​acky,只支持PHP4.考虑到 PHP 的流行程度,以及域名密钥对于将电子邮件分类为非垃圾邮件的重要性,我希望有更好的工具;你知道吗?你还有什么技巧可以推荐的吗?

The only one I found is http://php-dkim.sourceforge.net/; it looks incredibly hacky and supports PHP4 only. Considering how popular PHP is, and how critical DomainKeys are for email classification as non-spam, I'd expect better tools; do you know of any? Any other tricks you'd recommend?

额外信息:我正在使用外部 SMTP 提供商,因为我每天需要发送数千封电子邮件.

Extra info: I'm using an external SMTP provider because I need to send out thousands of emails per day.

推荐答案

我建议在 MTA 级别支持 DKIM,以便默认情况下对给定域的所有服务器生成的电子邮件进行签名.(除非您有充分的理由不签署所有服务器生成的域电子邮件).

I'd recommend DKIM support at the MTA level so all your server generated email for a given domain is signed by default. (unless you have a really good reason to not sign all server generated email for a domain).

使用 dkim-milter 和 sendmail(在我的例子中是 CentOS 5.2)在 LAMP 上设置 DKIM 的最佳起点是 Jeff Atwood 关于通过代码发送电子邮件的帖子.

The best starting point in my googling to get DKIM setup on LAMP with dkim-milter and sendmail (on CentOS 5.2 in my case) was Jeff Atwood's post about sending emails through code.

我同意他的观点,你应该解决的前两件事是反向 PTR 记录和 DKIM 签名.

I would agree with him that the first 2 things you should address are reverse PTR record and DKIM signing.

也很重要:

  1. 用于发送电子邮件的盒子的 IP 地址尚未被列入黑名单.
  2. 确保 postmaster@emailsendingdomain.com 是有效的邮箱
  3. 如果您的服务器生成的电子邮件需要看起来来自其他地方(例如需要来自表单中提供的姓名/电子邮件的联系表格)遵循这些电子邮件标题指南.

这是我使用的email ip address blacklist checker.

这 5 件事可能会解决您 95% 的电子邮件送达率问题.

Those 5 things will solve perhaps 95% of your email deliverability issues.

本 Fedora 指南/dkim-milter/postfix 也很不错.

我用于我的应用程序的 PHP 邮件库是 PHPMailer 5.1,它支持 DKIM(并且仅支持 PHP 5),但经过研究,我决定在 sendmail 级别实现是一个更好的解决方案.如您所见,即使是 PHPMailer 5.1 的作者也不建议在 PHP 邮件库级别使用 DKIM 是最好的解决方案 http://dkim.worxware.com/.

The PHP mail library I use for my app is PHPMailer 5.1 which has DKIM support (and is PHP 5 only), but after doing the research, I decided implementing at the sendmail level was a better solution. As you can see, even the author of PHPMailer 5.1 does not suggest DKIM at the PHP mail library level is the best solution http://dkim.worxware.com/.

祝你好运.

相关文章