Setting Up Domainkeys/Dkim in a PHP-Based Smtp Client

Setting up DomainKeys/DKIM in a PHP-based SMTP client

I'd recommend DKIM support at the MTA level so all your server generated email for a given domain is signed by default. (unless you have a really good reason to not sign all server generated email for a domain).

The best starting point in my googling to get DKIM setup on LAMP with dkim-milter and sendmail (on CentOS 5.2 in my case) was Jeff Atwood's post about sending emails through code.

I would agree with him that the first 2 things you should address are reverse PTR record and DKIM signing.

Also very important:


  1. IP address of the box to send email not already being blacklisted.
  2. make sure postmaster@emailsendingdomain.com is a valid email box
  3. if your server generated email needs to appear to come from somewhere else (like a contact form needing to come from name/email provided in a form) follow these guidelines for email headers.

Here is the email ip address blacklist checker that I used.

Those 5 things will solve perhaps 95% of your email deliverability issues.

This Guide for Fedora/dkim-milter/postfix is also very good.

The PHP mail library I use for my app is PHPMailer 5.1 which has DKIM support (and is PHP 5 only), but after doing the research, I decided implementing at the sendmail level was a better solution. As you can see, even the author of PHPMailer 5.1 does not suggest DKIM at the PHP mail library level is the best solution http://dkim.worxware.com/.

Best of luck to you.

Signing mails sent through SMTP with DKIM

Yes, it's actually a server configuration thing. But since you posted on SO, there is also a way to sign the mails manually from within PHP. http://php-dkim.sourceforge.net/

Also had been covered before here: Setting up DomainKeys/DKIM in a PHP-based SMTP client

DKIM Signature not validating when sending mail with PHP

I gave an answer to this here : Setting up DomainKeys/DKIM in a PHP-based SMTP client

Basically what you need to ensure is that you supply all the headers that your MTA adds to your out-going email. Because different systems are configured differently, there is no one size fits all solution.

Look at the message source which has failed the the signing (and is giving the Message Altered error) to ascertain which headers were added. Typically your MTA will add the Message-ID and Date header (the Date header may also cause a low spam assasin score if it is missing, so you could as well include it!).

Another common mistake is that you alter the message yourself AFTER signing the message, so ensure no modifications are made in your code after you have signed your message.

After determining which headers were added, then you should add those headers yourself (and therefore over-ride the default behaviour of your MTA adding them) to the email before signing.

DKIM Signature not validating when sending mail with PHP

I gave an answer to this here : Setting up DomainKeys/DKIM in a PHP-based SMTP client

Basically what you need to ensure is that you supply all the headers that your MTA adds to your out-going email. Because different systems are configured differently, there is no one size fits all solution.

Look at the message source which has failed the the signing (and is giving the Message Altered error) to ascertain which headers were added. Typically your MTA will add the Message-ID and Date header (the Date header may also cause a low spam assasin score if it is missing, so you could as well include it!).

Another common mistake is that you alter the message yourself AFTER signing the message, so ensure no modifications are made in your code after you have signed your message.

After determining which headers were added, then you should add those headers yourself (and therefore over-ride the default behaviour of your MTA adding them) to the email before signing.

How to Domainkeys/DKIM email signing using the C# SMTP client?

i didnt find much help on this issue, but my problem got solve by configuring smtp server.
i cant post those steps as i am using 3rd party smtp server and every server has their own configuration. after proper configuration my smtp automatically adds DM/DKIM signature.

Sign manually a message with DKIM

Here's a thread that includes some options for client-side DKIM signing - Setting up DomainKeys/DKIM in a PHP-based SMTP client .

That said, most mail servers support DKIM out of the box at this point - you may want to switch to one that does.



Related Topics



Leave a reply



Submit