Phpmailer use dkim

青春壹個敷衍的年華 提交于 2020-01-01 19:31:01

问题


Hi guys i've already configure my centos 6.5 (plesk) with postfix and dkim milter and if i send mail from webmail in my case roundcube dkim pass but if i try to send some email with phpmailer last version fail. i've read there http://dkim.worxware.com/ that is not necessary do another operations but not work anyway so i try to use tools in the bottom of page to create private and public keys and set another txt record i've already tried to add params like these:

$mail->DKIM_domain = 'dominio.it';
$mail->DKIM_private = 'class/.htkeyprivate';
$mail->DKIM_selector = 'phpmailer';
$mail->DKIM_passphrase = '1407195281';

also txt record in dns are correct and i also tried to use existing and work key genereted by dkim milter like this....

$mail->DKIM_domain = 'dominio.it';
$mail->DKIM_private = 'class/default.private';
$mail->DKIM_selector = 'default';

with my working (only with roundcube not with phpmailer) txt record

default._domainkey.quotalo.it

TXT

"v=DKIM1; g=*; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQ UAA4GNADCBiQKBgQCz2F9VF2 D2jFtlKPbjufdTBpF+2Qraw8Tr20 dSkHcP7DGb0rMjZYeeK7ysmj2R Go75/HnPga2Xbjy87Hg/xIDMQIc Ep8cN9WsOkUe7Rzx/jIhdwnV5u alHwlx0hJQ16LwgGv1Xtt1iw+X7 sDwRlZ+Tq2tyq0cXYz34RvAy22 GRiwIDAQAB"

but problem is the same....please help me i've tried one entire day :-(


回答1:


For anybody who is trying to set this up, I've just 'resolved' the PHPMailer DKIM issue, which in effect allows the DKIM signature to be "signed-by:mydomain.com" by following the steps below:

  1. Create Keys
    I used http://dkimcore.org/tools/ to create the necessary keys. Take the raw private key and paste everything from --BEGIN to END-- and save it to a .txt file named private.key (without the *.txt).

    I did the same thing with the public key, for a personal backup copy(in case I need to retrieve it later) and saved it as public.key. ~again this is just for a backup copy.

  2. Add Files
    Take the two files that you just created and add them to your server/site, for example in the Apache > Conf folder.

  3. Add TXT Record to your domains DNS settings
    Using the Public Key, you will need to create a TXT Record in your domains DNS settings. The public keys going to look something like this:

1450071.mydomain._domainkey.mydomain.com:v=DKIM1;p=EBAQUAA4GNADCBiQKBgQC2uPmYVUJZvxxoYQqyygJMP0jqRKQLJ2QRN1k1HLrNCc13yK7ReDY3KmuZH+pgUNzXpfKHz0PGVLTMUAKpsqAPtkMfll8DSZawrFrny/jQIzEc03gTrEKCwp/k0iaL/Pwcha7pZEiN+wIDA


The Host Name: 1450071.mydomain._domainkey

The Value: v=DKIM1;p=EBAQUAA4GNADCBiQKBgQC2uPmYVUJZvxxoYQqyygJMP0jqRKQLJ2QRN1k1HLrNCc13yK7ReDY3KmuZH+pgUNzXpfKHz0PGVLTMUAKpsqAPtkMfll8DSZawrFrny/jQIzEc03gTrEKCwp/k0iaL/Pwcha7pZEiN+wIDA

The TTL: 1 Hour(3600)


4. Add the following DKIM lines to PHPMailer *after the setFrom

$mail->setFrom($from, $from_name);

..

$mail->DKIM_domain = 'mydomain.com';
$mail->DKIM_private = 'path/to/your/private.key>';
$mail->DKIM_selector = '1450071.mydomain'; //Prefix for the DKIM selector
$mail->DKIM_passphrase = ''; //leave blank if no Passphrase
$mail->DKIM_identity = $mail->From;

Final result: Success!




回答2:


i've solved by adding $mail->Encoding = "base64"; To phpmailer array.



来源:https://stackoverflow.com/questions/25129659/phpmailer-use-dkim

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!