Warning: Missing argument 2 for wp_kses(), called in /var/www/wphost/wp-content/plugins/bsocial/components/open-graph.php on line 175 and defined in /var/www/wphost/wp-includes/kses.php on line 476

Using WordPress With External SMTP Server

I really don’t like having sendmail running on a webserver, but some features of WordPress just don’t work if it can’t send email (user registration, for example). Still, WordPress offers support to send email through external SMTP servers instead if a local mailer.

In /wp-includes/pluggable.php around line 377, change

	$phpmailer->isMail();

to

	$phpmailer->isSMTP();

Then, in /wp-includes/class-phpmailer.php around line 155, set your SMTP host:

    var $Host        = "my.smtphost.com";

You may also need to set a username and password, and tell WP to attempt authentication. You’ll see those in the lines below the hostname variable.

    var $SMTPAuth     = true;
    var $Username     = "username";
    var $Password     = "password";

On the other hand, you could do this via a plugin, perhaps even Callum McDonald’s WP Mail SMTP.

17 Responses to “Using WordPress With External SMTP Server”

  1. I love youuuu!!!! Thanks a lot!!

  2. Thanks for the help – I had a server at work that was tough to get everything setup on and your post made it very simple.

  3. thanks for the info
    It would have taken a lot of time to figure out myself about pluggable… :(

  4. Thanks for your help! I found a class-smtp.php in the named directory, so I guess that’s the one to use for SMTP configuration, isn’t it!? (WordPress version 2.3.3)

    • Oh I see – it should be class-phpmailer, as you said. Yet I’m actually wondering why one wouldn’t edit class-smtp for SMTP settings!? Anyways – never mind. Maybe this comment is a hint for other users.

  5. Thanks for sharing that with us. I did thsi to my WAMP server a couple of months ago. Then I did an upgrade to the latest version of wordpress and didn’t think put the SMTP mods back in place… doh!

  6. Works perfectly! Thanks.

    I’ve been having problems with my hosting’s sendmail and wanted to switch to gmail for notifications. Your post was all I needed to make the switch.

    Great Job!

  7. WOW….! What a great help… thank you very much. Worked nicely, perfectly and smoothly.

  8. Pheew!

    After loosing my password and noticing my email configuration was crap, I though I had to reinstall wordpress from scratch! Your post helped me recover my password :)

    Thank you!

  9. Excelent Tutorial, very easy, more than install a new plugin jejejej : )

    Greetings from Chihuahua, Mexico.

  10. Great work around!

  11. Thanks a lot, that was extremely useful

  12. Saved my day! Thanks a lot for sharing that information!

Trackbacks

User contributed tags for this post: