2

Hi We have set up the DKIM in our mail server using sendmail and configured our DNS record also. Still our mails are marked as spam. Also when we sent the mail from outlook the domainkey authentication is pass whereas when the mail is sent from PHP ( PEAR package MAIL ), Yahoo is marking authentication as fail

When sent via PHP, Yahoo is adding the following header Authentication-Results: mta150.mail.in.yahoo.com from=mydomain.com; domainkeys=fail (bad sig); from=mydomain.com; dkim=permerror (bad sig)

When sent from Outlook, the header is Authentication-Results: mta175.mail.in.yahoo.com from=mydomain.com; domainkeys=pass (ok); from=mydomain.com; dkim=pass (ok) which indicates that Domain Key authentication has passed

I examined the headers when sent from PHP and compared it with what Outlook is adding and did not see much difference. While sending it from PHP I am adding the headers From, To, Message-ID, Mime-Version, Date, Subject,Content-Type and Outlook is also having the same,

What else could be wrong in the mail while sending mail via PHP because of which authentication is failing

PHP does not use the local MTA on the server, it connects to the SMTP server ( SendMail ) which is on a different machine. The PEAR MAIL uses the socket API to connect to the SMTP server and uses the SMTP protocol, I do not think the mail is signed at the WebServer, it is only signed on the SMTP server.

We use SendMail on the Mail Server and both Outlook and PHP uses the same SMTP server with same login and password and same authentication mechanism

That is the reason why I am confused as to what could be the problem. Is there some standard way a mail should be constructed which can effect the signing of the mail, which Outlook is doing correctly but when done via PHP, the mail is constructed differently, at least we have verified that the headers are the same.

Below mentioned are the headers yahoo received when I sent mail to the that yahoo account. This mail is sent by PHP Zend framework.

Earlier I sent mail using PHP PEAR package, At that time Yahoo was adding the following header Authentication-Results: mta150.mail.in.yahoo[dot]com from=mydomain[dot]com; domainkeys=fail (bad sig); from=mydomain[dot]com; dkim=permerror (bad sig).

But Now when I use PHP Zend framework to send mail, dkim is set to pass(ok ) but domainkeys=fail. Header is as follows Authentication-Results: mta153.mail.in.yahoo[dot]com from=mydomain[dot]com; domainkeys=fail (bad sig); from=mydomain[dot]com; dkim=pass (ok).

So what does dominkeys=fail ( bad sig ) mean ? and how is it different from dkim=pass (ok )

X-Apparently-To       :  ravi.cybertechie@yahoo[dot]com via 203.104.18.180; Wed, 
                         28 Oct 2009 18:03:13 +0530
Return-Path           :  <admin@mydomain[dot]com>
X-YMailISG            :  YISh33wWLDtwDNH0f_08ONu7pG42J7wuD.SOtD4sPZcX_x7EOghleA5_M5U7vRhdf7ZIIIo0yVtS35PCaQRAY2w8Naq8c3wgufoQrWvJyQt6jIH0BRkuwgUERH7N7FHGLQpnCT0A9ig_TvthXoXJ3Vc.mQFe.OPT4CE6Vz1kgCsBEVxb.M2Zcr4BYK27XARjHg7hCsNDFi_ddp.Y.s6njtr7fnbQl0SD0gCcK2qNVxxKNhoukmuvpE4BPA_EyVEgNqJGjcBYh_GYqsapic4zKDWhcb4nOBAAzDR0XtydFiX3nj_TqDI0v_zNwuUK0K53tYdnI3HCSg--
X-Originating-IP      :  [my_smtpserver_ipaddress]
Authentication-Results: mta153.mail.in.yahoo[dot]com from=mydomain[dot]com; 
                        domainkeys=fail (bad sig); from=mydomain[dot]com;
                        dkim=pass (ok)
Received              : from my_smtpserver_ipaddress (EHLO my_smtpserver_hostname)
                        (my_domain_ip_address) by mta153.mail.in.yahoo[dot]com with SMTP; Wed,
                        28 Oct 2009 18:03:13 +0530
Received-SPF          : pass (my_smtpserver_hostname: authenticated connection)
                        receiver=my_smtpserver_hostname; client-ip=my_mailclient_ipaddress;
                        helo=localhost; envelope-from=admin@mydomain[dot]com;
                        x-software=spfmilter 0.97 
                        http://www.acme[dot]com/software/spfmilter/ with libspf2-1.0.0;
Received              : from localhost ([my_mailclient_ipaddress]) (authenticated bits=0) 
                        by my_smtpserver_hostname (8.14.2/8.14.2) 
                        with ESMTP id n9SCX6ml017820 for ; 
                        Wed, 28 Oct 2009 08:33:08 -0400
X-DKIM                : Sendmail DKIM Filter v2.5.1
                        my_smtpserver_hostname n9SCX6ml017820
DKIM-Signature        : v=1; a=rsa-sha256; c=simple/simple; d=mydomain[dot]com; s=mydomain;
                        t=1256733190; bh=oBeBoCqUcTrV/4cgaMK58OrPkchqCMzB2Vax aRRph6g=;
                        h=From:To:Subject:Date:Content-Type:MIME-Version;
                        b=faLHQ jAakBDkxbz8xhGmfi2ZfBHXUBFOWTZs9BAfaksB8lJghho6YmUPKIY5oMJMsCkh/QLQ 8RXD8dUPf04X6A==
X-DomainKeys          : Sendmail DomainKeys Filter v1.0.2 
                        my_smtpserver_hostname n9SCX6ml017820
DomainKey-Signature   : a=rsa-sha1; s=mydomain; d=mydomain[dot]com; c=simple; q=dns;                        b=3Wazgw8//NzW95FYyQGZdXDuc4mLkp6+OdOIv224+aC0imfrA3GoeSEIt0UTyaT9d ygfHc6OKuxy7cz0/a3FnA==
Message-Id            : 
From                  : mydomain Admin  Add sender to Contacts
To                    : Recipient 
Subject               : Mail from zend
Date                  : Wed, 28 Oct 2009 12:33:05 +0000
Content-Type          : multipart/alternative; charset="iso-8859-1";
                        boundary="=_2f9550c6ce7fb246f62d84f1221854d7"
MIME-Version         : 1.0
Content-Length       : 4918
Jeff Atwood
  • 13,104
  • 20
  • 75
  • 92

3 Answers3

1

It sounds like your PHP scripts are not sending the mail using the local MTA, while your Outlook client is. It's that MTA that needs to apply the DKIM signature to each message before it passes to another organization's servers. So, check your PHP configuration and code.

Phil Miller
  • 1,755
  • 1
  • 12
  • 17
1

If I understand right, what is being said is as follows:

  1. PHP (+PEAR MAIL) is installed on a Web Server.
  2. When you send an email through that, it uses the local MTA on the Web server.
  3. Your DKIM signature addition happens in a different MTA.
  4. Therefore PHP DKIM fails while Outlook is ok.

You can compare your Outlook SMTP Server settings with that of PHP and make sure they are the same. If not, make PHP relay through the same SMTP Server used by Outlook.

0

Below mentioned are the headers yahoo received when I sent mail to the that yahoo account. This mail is sent by PHP Zend framework.

Earlier I sent mail using PHP PEAR package, At that time Yahoo was adding the following header

Authentication-Results: mta150.mail.in.yahoo[dot]com from=mydomain[dot]com; 
domainkeys=fail (bad sig); from=mydomain[dot]com; dkim=permerror (bad sig). 

But Now when I use PHP Zend framework to send mail, dkim is set to pass(ok ) but domainkeys=fail. Header is as follows

Authentication-Results: mta153.mail.in.yahoo[dot]com from=mydomain[dot]com; domainkeys=fail (bad sig); from=mydomain[dot]com;
dkim=pass (ok).

So what does dominkeys=fail ( bad sig ) mean ? and how is it different from dkim=pass (ok )



X-Apparently-To       :  ravi.cybertechie@yahoo[dot]com via 203.104.18.180; Wed, 
                         28 Oct 2009 18:03:13 +0530

Return-Path           :  <admin@mydomain[dot]com>

X-YMailISG            :  YISh33wWLDtwDNH0f_08ONu7pG42J7wuD.SOtD4sPZcX_x7EOghleA5_M5U7vRhdf7ZIIIo0yVtS35PCaQRAY2w8Naq8c3wgufoQrWvJyQt6jIH0BRkuwgUERH7N7FHGLQpnCT0A9ig_TvthXoXJ3Vc.mQFe.OPT4CE6Vz1kgCsBEVxb.M2Zcr4BYK27XARjHg7hCsNDFi_ddp.Y.s6njtr7fnbQl0SD0gCcK2qNVxxKNhoukmuvpE4BPA_EyVEgNqJGjcBYh_GYqsapic4zKDWhcb4nOBAAzDR0XtydFiX3nj_TqDI0v_zNwuUK0K53tYdnI3HCSg--

X-Originating-IP      :  [my_smtpserver_ipaddress]

Authentication-Results: mta153.mail.in.yahoo[dot]com from=mydomain[dot]com; 
                        domainkeys=fail (bad sig); from=mydomain[dot]com;
                        dkim=pass (ok)

Received              : from my_smtpserver_ipaddress (EHLO my_smtpserver_hostname)
                        (my_domain_ip_address) by mta153.mail.in.yahoo[dot]com with SMTP; Wed,
                        28 Oct 2009 18:03:13 +0530

Received-SPF          : pass (my_smtpserver_hostname: authenticated connection)
                        receiver=my_smtpserver_hostname; client-ip=my_mailclient_ipaddress;
                        helo=localhost; envelope-from=admin@mydomain[dot]com;
                        x-software=spfmilter 0.97 
                        http://www.acme[dot]com/software/spfmilter/ with libspf2-1.0.0;

Received              : from localhost ([my_mailclient_ipaddress]) (authenticated bits=0) 
                        by my_smtpserver_hostname (8.14.2/8.14.2) 
                        with ESMTP id n9SCX6ml017820 for <ravi.cybertechie@yahoo[dot]com>; 
                        Wed, 28 Oct 2009 08:33:08 -0400

X-DKIM                : Sendmail DKIM Filter v2.5.1
                        my_smtpserver_hostname n9SCX6ml017820

DKIM-Signature        : v=1; a=rsa-sha256; c=simple/simple; d=mydomain[dot]com; s=mydomain;
                        t=1256733190; bh=oBeBoCqUcTrV/4cgaMK58OrPkchqCMzB2Vax aRRph6g=;
                        h=From:To:Subject:Date:Content-Type:MIME-Version;
                        b=faLHQ jAakBDkxbz8xhGmfi2ZfBHXUBFOWTZs9BAfaksB8lJghho6YmUPKIY5oMJMsCkh/QLQ 8RXD8dUPf04X6A==

X-DomainKeys          : Sendmail DomainKeys Filter v1.0.2 
                        my_smtpserver_hostname n9SCX6ml017820

DomainKey-Signature   : a=rsa-sha1; s=mydomain; d=mydomain[dot]com; c=simple; q=dns;
                        b=3Wazgw8//NzW95FYyQGZdXDuc4mLkp6+OdOIv224+aC0imfrA3GoeSEIt0UTyaT9d ygfHc6OKuxy7cz0/a3FnA==

Message-Id            : <200910281233.n9SCX6ml017820@my_smtpserver_hostname>

From                  : mydomain Admin <admin@mydomain[dot]com> Add sender to Contacts

To                    : Recipient <ravi.cybertechie@yahoo[dot]com>

Subject               : Mail from zend

Date                  : Wed, 28 Oct 2009 12:33:05 +0000

Content-Type          : multipart/alternative; charset="iso-8859-1";
                        boundary="=_2f9550c6ce7fb246f62d84f1221854d7"

MIME-Version         : 1.0

Content-Length : 4918

serverAdmin123
  • 230
  • 3
  • 18