为什么是smtplib.SMTP().sendmail未发送DKIM签名邮件

2024-09-30 16:32:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经在服务器上设置了postfix和openDKIM。在

当我跑步时:

echo "Testing setup" | mail -s "Postfix test" {my_email_address}

我收到电子邮件,邮件头中有一个DKIM-Signature头。在

但是,当我使用smtplib编写python脚本发送电子邮件时:

^{pr2}$

到达我收件箱的电子邮件缺少DKIM-Signature头,在Authentication-Results中我看到{}

所以我的问题是: 我是否需要手动签署我的电子邮件(例如,与dkimpy),或有一些设置,我可以让它为我签名?在

如果你需要什么额外的信息,请告诉我。在


Tags: testecho服务器电子邮件emailmysetupmail
1条回答
网友
1楼 · 发布于 2024-09-30 16:32:47

很难说有什么配置信息。但是OpenDKIM的信息是这样说的:

A message will be verified unless it conforms to the signing criteria, which are: (1) the domain on the From: address (if present) must be listed by the −d command line switch or the Domain configuration file setting, and (2) (a) the client connecting to the MTA must have authenticated, or (b) the client connecting to the MTA must be listed in the file referenced by the InternalHosts configuration file setting (or be in the default list for that option), or (c) the client must be connected to a daemon port named by the MTAs configuration file setting, or (d) the MTA must have set one or more macros matching the criteria set by the MacroList configuration file setting.

在您的SMTP代码中,您显然没有通过MTA的身份验证。那么问题就变成了,您的配置是否允许OpenDKIM以任何其他方式注意到您的需求,例如在InternalHosts中使用localhost?(我认为这是默认值,但可能您已经覆盖了它。)

相关问题 更多 >