For Servers With HSTS, Servers With Router Like on HP Cloud, You Can Easily Receive Email From WordPress Using Mandrill Instead of Postfix. At TheCustomizeWindows, we use Mandrill to handle the Emails instead of very difficult server side setup (due to HSTS). Mandrill is a Cloud Based Transactional Email Service, it normally does require another Email service – like we use Google Apps for our Email Services. admin@thecustomizewindows.com
, webmaster@thecustomizewindows.com
are configured for Google Apps in Desktop Email Clients. You can read an old guide for SMTP POP3 settings.
Receive Email From WordPress Using Mandrill : Free Signup & Mandrill Settings For DNS
First signup for Mandrill, you will get 12K Email transactions free of cost. Practically lifetime can be spend with the free tier if you are using for contact form only. Mandrill has a WordPress Plugin, we will not use it. We will add simple few lines of snippets only.
First add your domain on Mandrill, second add forwarding email address. Now, you have to add one TXT entry on your DNS (you might be using Akamai or CloudFlare or HP Cloud or Rackspace DNS or DynDNS or Amazon R3) which will be given on Mandrill account. Very easy. It will look like this :
---
1 | v=DKIM1; k=rsa; p=MIG AB; |
This is called DKIM settings and can be found under Domains > Sending Domains on Mandrill account, you have to add this against a subdomain named mandrill._domainkey.yourdomain.tld
with a TTL of 300s. Another entry needs to be edited on DNS, that is Sender Policy Framework (SPF). You will have an entry if you are already using Google Apps like 100% common Email Service for your domain, which is a TXT record and looks like :
1 | v=spf1 ip4 ... ~all |
Only add include:emailsrvr.com
on this record in proper place. Test the DNS settings from Mandrill account, you should be passed. Mandrill will ask to verify your email. Easy thing.
Receive Email From WordPress Using Mandrill : WordPress Part
Hummmm. You do not need any WordPress Plugin. You will see that, many websites ask to add snippets on Theme or Child Theme’sfunctions.php
file. We wrote an easy guide on how to create a simple plugin to manage all these snippets in one place as one plugin.
Wherever, in whatever method you add this snippet does not matter (on Theme or Child Theme’s functions.php
file or Plugin), it will work :
1 2 3 4 5 6 7 8 9 | add_action( 'phpmailer_init', 'wph_phpmailer_init' ); function wph_phpmailer_init( PHPMailer $phpmailer ) { $phpmailer->IsSMTP(); $phpmailer->SMTPAuth = true; $phpmailer->Port = 587; $phpmailer->Host = 'smtp.mandrillapp.com'; $phpmailer->Username = 'MANDRILL_USERNAME'; // change it $phpmailer->Password = 'MANDRILL_API_KEY'; // generate your own and change it. } |
Copy-Paste the snippet on any text editor first. If you had postfix
or sendmail
on your Ubuntu server installed, you can remove it :
1 | apt-get purge postfix sendmail |
These are not needed anymore.
Tagged With mandrill