The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP and DKIM

Discussion in 'E-mail Discussions' started by gchesnut, May 29, 2014.

  1. gchesnut

    gchesnut Member

    Joined:
    May 29, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Server host = LiquidWeb with cPanel & WHM

    Objective: add DKIM to PHP script sent mail

    Results with WHM default DKIM enabled:
    1) webmail sent via Squirrelmail has valid/pass DKIM record
    2) PHP script emails do not

    Is there a way to activate the WHM DKIM Txt record for PHP script emails or do we have to add a PHP DKIM library and code for the PHP script mails ?

    DKIM is new to use.

    Appreciate any assistance and guidance. Thanks in advance,

    Gary
    ....:)
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Re: Php dkim

    Hello :)

    Are you using DSO as your PHP handler? If so, this is addressed in the Email Authentication document:

    Add Headers in DKIM
    If you already use DSO and you enable DKIM, emails sent will not have information in the Return-Path, Reply-To, or From fields in the email header. As a result, DKIM will show that nobody is the sender. If you use a PHP script, you should manually add the headers. The following is an example of a PHP script that adds the missing parts to an email header:


    Code:
    <?php
    $to      = 'nobody@example.com';
    $subject = 'the subject';
    $message = 'hello';
    $headers = 'From: webmaster@example.com' . "\r\n" .
        'Return-Path: webmaster@example.com' . "\r\n" .
        'Reply-To: webmaster@example.com' . "\r\n" .
    mail($to, $subject, $message, $headers);
    ?>
     
  3. gchesnut

    gchesnut Member

    Joined:
    May 29, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Re: Php dkim

    cPanelMichael,

    Yes, we are using DSO. We are filling the fields from the PHP script; Reply-To with the senders email address and From with no_reply from our domain. We are not filling the Return-Path field.

    Is not having the Return-Path field the reason the PHP script emails are not using the WHM enabled DKIM Txt record?

    Appreciate your help. Thanks,

    Gary
    ....
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Re: Php dkim

    Yes, you must use all of the fields listed in the example from my last response or DKIM will not work as expected.

    Thank you.
     
  5. gchesnut

    gchesnut Member

    Joined:
    May 29, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Re: Php dkim

    cPanelMichael,

    Here’s current status:
    - cPanel DKIM enabled with default cPanel DKIM entry
    - Reply-To, Return-Path fields in email header are filled
    - From is from no_reply@domain.com
    - DNS ZoneFile /https://www.ultratools.com/tools/zoneFileDumpResult reports - No DKIM found in DNS

    Question – any idea why DKIM is not found in DNS ?

    Domain Key was found.

    Thanks,

    Gary
    ....
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Re: Php dkim

    Feel free to open a support ticket so we can take a closer look. You can post the ticket number here so we can update this thread with the outcome.

    Thanks.
     
  7. gchesnut

    gchesnut Member

    Joined:
    May 29, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Re: Php dkim

    support ticket number = 5012831
     
  8. gchesnut

    gchesnut Member

    Joined:
    May 29, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Re: Php dkim

    Per cPanel Tech Support "It would not work because you would have to manually configure the PHP to send the mail with DKIM signed signatures, something that mail sent by cPanel itself is done automatically".

    PHP script mails must be coded to send mail with DKIM signature.

    Anyone know of simple, easy to configure PHP Mail DKIM signature code source.

    Gary
    ....

    Gary
    ....
     
Loading...

Share This Page