How to add SPF/DKIM details

Start here for Version 3 phpList! No need to ask twice

How to add SPF/DKIM details

Postby Dragonrider » 11:19am, Tue 20 Aug, 2013

Sometimes when sending by php mail() your emails may be classified as Spam! The dreaded Spam!

The solution to avoiding this is to use your own Email settings in place of the php mail() and if necessary, add SPF and DK records.

First, open the lists/config/config.php file, find the smtp section, around line 525-540.

Code: Select all
# To use a SMTP server please give your server hostname here, leave it blank to use the standard
# PHP mail() command.
define("PHPMAILERHOST",'');

# in the above you can specify multiple SMTP servers like this:
# 'server1:port1;server2:port2;server3:port3' eg
#define('PHPMAILERHOST','smtp1.mydomain.com:25;smtp2.mydomain.com:2500;smtp3.phplist.com:5123');

# if you want to use smtp authentication when sending the email uncomment the following
# two lines and set the username and password to be the correct ones
#$phpmailer_smtpuser = 'smtpuser';
#$phpmailer_smtppassword = 'smtppassword';

## you can set this to send out via a different SMTP port
# define('PHPMAILERPORT',25);


Change the settings as follows, substituting your email settings as required.

Code: Select all
define("PHPMAILERHOST",'mail.domain.com');


If necessary, you can now specifiy a port as well as the domain.

Code: Select all
define("PHPMAILERHOST",'mail.domain.com:25');


Remove the two hash's from the following two lines and replace the two values with your own email login and password.

Code: Select all
$phpmailer_smtpuser = 'web@domain.com';
$phpmailer_smtppassword = 'your_password';


Check that this works by sending out a test message to yourself, remember that the email to which you are sending must exist as a subscriber, but now, if it doesn't, you'll be offered a link to add the email as a subscriber.

Hopefully this works. if it doesn't you'll need to work out what detail you've got wrong when entering your email settings.

So, assuming you have successfully changed from php mail() to your own SMTP, you can now log in to your web server's cPanel and with some luck, you'll find an option to enable SPF, might be a simple tick/click to enable SPF in your email sub-section, otherwise you'll need to visit a site like Microsoft's SPF Wizard. Follow the instrctions on this and add the SPF settings to your DNS (cPanel Domain settings) as a Custom TXT.

Now, again if your server cPanel offers enable DK(IM), enable it, it's a doddle that way.

If not, run the Port25 DKIM Wizard, start with your domain and key1, this takes you through the details you'll need, most of the time default settings are ok.

Again, follow the instructions on how to add DKIM to your domain, and set up the two Custom TXT fields in your DNS area (_domainkeys and key1_domainkeys) set the refresh time to 900 (or the minimum your host allows) save it all and after the minimum time, you should find your emails now have SPF and DKIM keys set.

It all helps cut down on your Campaigns being classified as spam.

You should also be able to check that your SPF records are correct, or combine the two at Port25's SPF/DKIM email validation.
Dragonrider
Moderator
 
Posts: 3460
Joined: 6:58am, Sun 02 Jul, 2006
Location: Ilkley, West Yorkshire, United Kingdom

Return to Frequently Asked Questions

Who is online

Users browsing this forum: No registered users and 1 guest