php - 使用DKIM键在phpmailer中发送邮件

标签 php email phpmailer dkim

当前,我正在使用phpmailer发送邮件。现在如何通过DKIM key 在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 unit tests,那么有一个如何设置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签名。

关于php - 使用DKIM键在phpmailer中发送邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24463425/

相关文章:

php - PHPMailer 的阿拉伯语问题

PHP:从数据库中提取的列中的日期未更新(phpMyAdmin)

javascript - jQuery 验证在联系表单中不起作用

php - Yii2 GridView 列数据作为相关表属性的链接

php - 电子邮件未发送 mdaemon 配置完成但邮件未发送通过且未收到错误 php 文件

vb.net 发送电子邮件

PhpMailer 与 SwiftMailer?

php - Joomla UTF-8 编码在打开邮件时失败

PHP上传问题

php - 如何使用 Laravel 将数据加载到 Select2