使用DKIM Keys在phpmailer中发送邮件

Var*_*ran 19 email phpmailer dkim

电流我使用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 = '';
Run Code Online (Sandbox Code Playgroud)

我能知道它的可能性吗?请帮助我

Syn*_*hro 36

如果你看看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;
Run Code Online (Sandbox Code Playgroud)

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

  • 感谢您的帮助.有关如何在达到这一点之前设置DKIM的完整指南,我整理了一份指南http://yomotherboard.com/how-to-setup-email-server-dkim-keys/ (8认同)
  • `DKIM_identifier`现在是`DKIM_identity`(PHPMailer 5.2.13) (6认同)
  • DKIM_selector是DNS TXT记录上的选择器密钥设置.它并不总是像示例中的phpmailer. (3认同)
  • `DKIM_selector`总是''phpmailer'`? (2认同)
  • 要使用私钥字符串而不是设置文件路径,只需在phpMailer对象上指定`$ mail - > DKIM_private_string`属性即可. (2认同)