scriptygoddess

03 Jun, 2008

Get WordPress to use sendmail instead of mail()

Posted by: Jennifer In: WordPress|WordPress Hacks

Same project I just mentioned below – something funky was going on with WordPress not sending emails. I had a server admin looking at the server and I'd submit a comment on the corporate blog and no emails would get sent. I even tried using a plugin that forced wordpress to use SMTP, still would not send emails from the blog.

I found on the support forums where someone mentioned a hack to get WordPress to use sendmail. In wp-includes folder open the file pluggable.php. Around line 362 is the following:

// Set to use PHP's mail()
$phpmailer->IsMail();

Change that to:
// Set to use PHP's mail()
//$phpmailer->IsMail();
$phpmailer->IsSendmail();

As soon as I did that – voila – it started sending emails.

(yes, I know, I'm modifying core code again. Tell me how to make this a plugin and I will!)

Related posts:

  1. Two Blocks of Content for Pages in WordPress I just saw this plugin show up on the WordPress...
  2. Search from WordPress Admin (Post Listing) Redirecting to Home Page This is possibly the most bizarre thing I've ever seen....
  3. Adding a block of HTML to a WordPress post One problem with the WYSIWYG editor in WordPress is that...
  4. Conditionally change path to HTTPS One of my clients had set it up so that...

Related posts brought to you by Yet Another Related Posts Plugin.

7 Responses to "Get WordPress to use sendmail instead of mail()"

1 | lucas

June 4th, 2008 at 7:56 pm

Avatar

honestly, i really think people should get away from the bloatware that is wordpress. this is just one more example…

why can't they put that in the wp-config.php file?

2 | Aslam Multani

March 4th, 2009 at 1:07 am

Avatar

Hey…
This started mailing from my wordpress blog too….
thanks for the solution

3 | Harry

March 16th, 2009 at 5:17 pm

Avatar

I'm still having trouble with this…
Do you have to restart wordpress somehow for the changes to take affect? Or should it work right away?

Doesn't IsMail use PHP's mail() function which uses sendmail anyway??

4 | Jennifer

March 16th, 2009 at 7:38 pm

Avatar

isMail() and isSendMail() are seperate functions of phpmailer. I wish I could find the original thread in the forums about this. But I do have this which may or may not help: http://phpmailer.codeworxtech.com/index.php?pg=methods which explains (albeit vaguely) the difference between those two methods…

5 | rebekah

April 4th, 2009 at 11:44 am

Avatar

Thanks for the tip. I couldn't get the contact form in WordPress to work. But then I used your suggestion above and this fixed the problem immediately.

Thanks,

Rebekah

6 | Jettochkin

January 18th, 2010 at 12:37 pm

Avatar

Excellent solution!

Spent two days going through the whole system! The solution works for Sendmail 8.14.x and WordPress MU 2.9.1!

Thank you very much

7 | Nathan

January 21st, 2010 at 4:40 pm

Avatar

Worked perfectly! Thank you so much for posting this solution.

Comment Form

Featured Sponsors

About


Advertisements