繁体   English   中英

使用 DKIM 密钥在 phpmailer 中发送邮件

[英]Send mail in phpmailer using DKIM Keys

Currents 我正在使用 phpmailer 发送邮件。 现在如何使用 DKIM 密钥在 phpmailer 中发送电子邮件

我在 phpmailer 类文件中搜索,我找到了下面的代码

    /**
     * DKIM selector.
     * @type string
     */
    public $DKIM_selector = '';

    /**
     * DKIM Identity.
     * Usually the email address used as the source of the email
     * @type string
     */
    public $DKIM_identity = '';

    /**
     * DKIM passphrase.
     * Used if your key is encrypted.
     * @type string
     */
    public $DKIM_passphrase = '';

    /**
     * DKIM signing domain name.
     * @example 'example.com'
     * @type string
     */
    public $DKIM_domain = '';

    /**
     * DKIM private key file path.
     * @type string
     */
    public $DKIM_private = '';

我能知道它是如何可能的吗?

如果您查看PHPMailer 单元测试,有一个关于如何设置 DKIM 的示例。

以下是发送消息所需的基础知识(显然,更改域、密钥路径和选择器以匹配您的配置,并在使用密码时添加密码); 这还假设您打算使用与您的From地址相同的标识符进行签名:

$mail->DKIM_domain = 'example.com';
$mail->DKIM_private = '/path/to/my/private.key';
$mail->DKIM_selector = 'phpmailer';
$mail->DKIM_passphrase = '';
$mail->DKIM_identity = $mail->From;

当您send()消息时(而不是之前),它将使用这些设置来生成 DKIM 签名。

我有以下经验:

  1. http://dkim.worxware.com/createkeys.php上生成的一对密钥可能适用于 SHA1,而class.phpmailer.php的最新版本 5.2.14 适用于 SHA256。
    上面的例子不起作用。
  2. 我在 SHA1 上从 SHA256 更改了class.phpmailer.php中的所有设置和功能(我将所有字符串 SHA256 替换为字符串 SHA1)。
    我的用于 DKIM 签名的 PHP 脚本已经可以运行了。

从这里开始

http://dkim.worxware.com/

在底部 - 单击继续....这将带您到工具生成私钥,公钥以及如何使用它们

它将使您生成带有指令的私钥/公钥

简而言之: - 使用私钥/公钥文件发送seup以在电子邮件头中添加dkim头 - 修改公钥的DNS txt记录

截至今天的日期没有任何教程 - 我发现它几个月之后无处可去

HTH

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM