问题描述
我正在使用PHPmailer发送电子邮件.
I`m using PHPmailer to sent email.
我安装了postfix服务和DKIM-Milter来生成密钥.
I installed postfix service and DKIM-Milter to generate the key.
如果我使用命令行发送邮件,并且邮件带有显示"signed-by:mydomain.com"的DKIM签名,则效果很好
It works fine if i use command line to sent mail, and the mail is with DKIM signature displaying "signed-by:mydomain.com"
Authentication-Results: mx.google.com; spf=pass (google.com: domain of [email protected] designates 182.50.xxx.xxx as permitted sender) [email protected]; dkim=pass [email protected]
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mydomain.com; s=default;
t=1325531456; bh=+gZFhu4Id2AXb8UVbFLzDVVlChWGhvxvJUIdjdMLQsk=;
h=To:Subject:Message-Id:Date:From;
b=mH4GV8ayicc6UMn1uopCc9VJb5v2MiOKQpEtwJjckzoJ8ePhRKQIZI5KnzSdSoSP3
BtmehOQhMn9kIR/TlL2dlSog2EkRNeAaWcmO1K3khtCZ7rkXHGJsDn9C6l49K0tJa2
rplPOSI7wS8+3NCEiuc5sjZimPo4v9WuTECVqxkg=
但是我想使用PHPmailer(5.1)发送支持DKIM签名的邮件,但是返回以下内容:
But i want to use PHPmailer (5.1) to sent mail with DKIM signature supported, but returns this:
Authentication-Results: mx.google.com; spf=pass (google.com: domain of [email protected] designates 182.50.xxx.xxx as permitted sender) [email protected]; dkim=neutral (bad format) [email protected]
DKIM-Signature: v=1; a=rsa-sha1; q=dns/txt; l=70; s=default;
t=1325533594; c=relaxed/simple;
h=From:To:Subject;
d=mydomain.com; [email protected];
z=
|
|Subject:=20Testing=20email=20from=20phpmailer;
bh=lC+16EvauA2HuJG03ArE6CtgLuY=;
b=
我检查了class.phpmailer.php文件,它具有一些DKIM选项:
I checked the class.phpmailer.php file, and it has some DKIM options:
public $DKIM_selector = 'default';
/**
* Used with DKIM DNS Resource Record
* optional, in format of email address '[email protected]'
* @var string
*/
public $DKIM_identity = '';
/**
* Used with DKIM DNS Resource Record
* optional, in format of email address '[email protected]'
* @var string
*/
public $DKIM_domain = '';
/**
* Used with DKIM DNS Resource Record
* optional, in format of email address '[email protected]'
* @var string
*/
public $DKIM_private = '';
如何配置此选项?我知道公钥和私钥,但是$ DKIM_private和$ DKIM_identity是什么?
How to configure this option? I know the public key and private key, but what`s is $DKIM_private and $DKIM_identity?
推荐答案
$ DKIM_private用于您的私钥和$ DKIM_identity,我不确定,但是它是可选的,您可以在此处找到更多信息: http://dkim.org/specs/draft- allman-dkim-base-01.html#anchor9 .这是一些示例代码.
$DKIM_private is for your private key and $DKIM_identity, well I'm not sure, but it's optional, and you can find more info here: http://dkim.org/specs/draft-allman-dkim-base-01.html#anchor9. Here is some example code.
$mail->DKIM_domain = 'mydomain.com';
$mail->DKIM_private = '/path/to/private_key';
$mail->DKIM_selector = 'default'; //this effects what you put in your DNS record
$mail->DKIM_passphrase = '1234567';
希望有帮助
这篇关于如何使用带有DKIM签名的Phpmailer发送电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!