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!)

8 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.

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements