There could be a couple issues causing WordPress to not send mail however in a server move the most likely is that the previous server was using Sendmail and the new server is using a different mail server like Postfix or vice versa. There also are a couple ways to resolve the issue and I will explain each method below however I recommend installing a WordPress Add-on to resolve the issue versus modifying a core WordPress file that could inadvertently be overwritten in the future.

The two ways which are described in detail to resolve this issue are to either install the WP-Mail-SMTP WordPress plugin or to modify the pluggable.php file located in the /wp-root/wp-includes directory. Each method will change the way that the $phpmailer function sends mail.

Modify pluggable.php:
**NOTE** Modifying pluggable.php is not the recommended solution and is here to simply provide more than one option.

  1. Open pluggable.php:First locate and open pluggable.php in your favorite editor such as vi which is my favorite editor. The file is located in the wp-includes directory that is located in the root of your WordPress installation so use something like the below command from the root of your WordPress install to open and start editing the file. Remember to always backup a file before you begin editing it.
    cp -p wp-includes/pluggable.php wp-includes/pluggable.php.orig
    vi wp-includes/pluggable.php
    
  2. Modify Line #381:  Replace line #381 in the pluggable.php file from “$phpmailer->IsMail();” to “$phpmailer->IsSMTP();”. Once this has been replaced save the file.
  3. Test & Verify:Now check to see if mail is being sent from WordPress. This can be done numerous ways which I assume you know the way WP was not sending mail if you are reading this article. An example might be leaving a comment to a post.

Install WP-Mail-SMTP WordPress Plugin:

  1. WordPress Admin:Login to the admin portion of your WordPress site which is http://yourdomain.com/wp-admin by default.
  2. Expand Plugins:Click the arrow to the right of Plugins in the left navigation menu to expand the options below which include Installed, Add New, Editor, and Akismet Configuration.
  3. Locate WP-Mail-SMTP Plugin:Now click the Add New link to being the process of adding WP-Mail-SMTP. Type “wp-mail-smtp” in the search field near the top of the center column and then click the Search button. WP-Mail-SMTP should display at the top of the search results.
  4. Install WP-Mail-SMTP: Click Install under the Actions column of WP-Mail-SMTP. Follow the directions to complete the installation process.
  5. Activate WP-Mail-SMTP:Now activate the plugin by clicking on Installed underneath the Plugins section of the left navigation. Location WP-Mail-SMTP in the list and activate it.
  6. Configure WP-Mail-SMTP: Once activated there will be a new section under the Settings section of the left navigation menu called Email. Click on that settings link to launch the WP-Mail-SMTP configuration. For a quick test select the “Use PHP mail() function to send emails” radial button. Once selected click the Update Options button and then test WP sending email by using the “Send a Test Email” function at the bottom of the WP-Mail-SMTP configuration page. If you want to configure an external SMTP server do so now and then update the options.

Again my suggestion would be to make this change by adding the WP-Mail-SMTP plugin so in future upgrades you do not have to remember to modify the pluggable.php file. One way to see the details of the server sending mail is to view the /var/log/maillog file if you have access to do so on the server. This can point out other possible mail issues on the server.


List Price: $39.99 USD
New From: $11.45 USD In Stock
Used from: $5.00 USD In Stock


List Price: $39.99 USD
New From: $10.99 USD In Stock
Used from: $0.01 USD In Stock

DeliciousStumbleUponDiggTwitterFacebookRedditLinkedInEmail
Tags: , , , , , , , , , , , , ,
12 Responses to “WordPress Not Sending Mail After Moving Site to a New Server”
  1. flyttst says:

    Admiring all the effort you put into your blog. I particular liked this post. Best regards, Pearl Kramer ~ Flyttst

    [Reply]

    alex Reply:

    Hello flyttst,

    Thanks for taking the time to leave feedback. Glad you enjoyed the article.

    Thanks.
    alex

    [Reply]

  2. Mike says:

    Alex,

    Very informative. Thank you.

    1. If I were to install the SMTP server plugin to my WordPress blog, how does that ensure that all email sent from the blog goes though it?

    2. I want to ensure that I get a copy of each email going out of the blog (or it is stored in a log file within my blog that I have access to). How do I accomplish that?

    3. I assume that setting the SMTP server will entail using an email address I have setup. Where do I specify the password of the mailbox so that the SMTP server can use it? Is that done within the SMTP server, or a within a WordPress configuration file?

    Let me know (send copy to my email as well.)

    Thank you again for a very informative article.
    Mike

    [Reply]

    alex Reply:

    Hello Mike,

    It depends on the specific mail you are talking about really. Different scenarios of email are handled differently by the server though you could always customize anything and make it send a copy to your email address as well. As for a log of the mail it would also depend on what your final configuration is.. for instance if you send through your own server then a record will be kept in “/var/log/maillog” if the server is a Linux server or if you send through Google then a record will be kept in Sent Items of the account you send through.

    There really are many variables so it depends on the scenario. We do all sorts of customization through our business of WordPress blogs so if you need further assistance feel free to contact us via the Contact form on the site and we would be happy to set up some consulting time with you in the near future. WordPress is great and fairly easy to work with though so if you want to do it yourself I am sure you can accomplish your goals as long as you spend the time to understand the guts of the software.

    Thanks.
    alex

    [Reply]

  3. Sunil Jackson says:

    I do agree with your opinion on this, I am sure i will getting more quality post from you. Just bookmarked your site. Many thanks for this

    [Reply]

    alex Reply:

    Hello Sunil,

    Thanks for the compliment. I hope to continue and provide posts that you find informative.

    Thanks.
    alex

    [Reply]

  4. valentinstag geschenkideen says:

    I really liked your blog! nice

    [Reply]

    alex Reply:

    Hello valentinstag,

    Thanks for the compliment and taking the time to leave feedback.

    Thanks.
    alex

    [Reply]

  5. Mike Johansen says:

    Hey I landed on your site by accident on bing while hunting for something really irrelevant but I am truly glad that I did, You have just caught yourself another subscriber. :)

    [Reply]

    alex Reply:

    Hello Mike,

    Thanks for leaving feedback. I am surprised to hear you say you reached our site using Bing as it accounts for only 0.3% of our search engine traffic compared to Google which accounts for 79. 1% of our search engine traffic. The Bing search engine traffic has increased slightly though over the past couple of months for instance in December the traffic was 0.25% of the search engine traffic sent to this site.

    Even more interesting is it appears that Microsoft has either set up spam bots or is paying people to spam the comment sections of web sites. We have seen a rise in the amount of traffic to multiple web properties we own or manage all including a slight variation of the text you have posted above along with various different comments with similar, “Pro Microsoft Bing Search Engine” content. If Microsoft wants Bing to continue to grow it wouldn’t seem effective to spam comment sections of sites.

    Anyhow we would love to hear feedback from you if we are incorrect in our assessment of the comment you posted. Are you a real person? Do you really think Bing is superior in some way than other search engines? Why post something relating to Bing in the comments section of a technical article that includes information relating to WordPress and sending email? By no means is this an attempt to be ride but I am more curious than anything else.

    Thanks.
    alex

    [Reply]

  6. Eleanor Simpson says:

    I use Bing and Google whenever i want to find something on the internet. I think that both search engines are very good. `

    [Reply]

    alex Reply:

    Hello Eleanor,

    Even though you are a comment spambot I wanted to respond. Bing is not even in the same ballpark in terms of results compared to Google. Its like a bloated waste of energy. If you have a search engine that doesn’t perform as well as Google and you dress it up in lots of pretty graphics its still going to be a a search engine that doesn’t perform as well as Google. While many people might love the graphics and bloat I personally am even less interested in exploring it because it is to much.

    You should work at tweaking your comment spam bot to at least leave accurate comments in response to article posts. :)

    Thanks.
    alex

    [Reply]

  7.  
Leave a Reply

*Type the letter/number combination in the abvoe field before clicking submit.

*