Plugin: wpPHPMailer

This plugin has been deprecated! It is no longer being developed and there will not be any continued support for it. Comments to this post are also now closed.

Fear not, for the essence of the plugin continues on in my Configure SMTP plugin.

Name:
wpPHPMailer
Author:
Scott Reilly
Version:
1.6
Last updated:
29 July 2005
Description:
Enable WordPress to send e-mail via SMTP instead of via PHP’s mail() function (aka sendmail).

Notes:

Since I didn’t want to install and run sendmail merely to support WordPress’s notifications, I opted to have WordPress send directly to the mail server. Fortunately, PHPMailer provides all the functionality I wanted to use (and more). This plugin makes use of PHPMailer (and one slight core code change) to negate the need for sendmail. In addition, by using PHPMailer a host of other mail features could be exploited. For instance, the plugin supports:

  • Auto-wordwrap length for message
  • Single or multiple SMTP servers
  • Hard-coding of all notification origination e-mail addresses (i.e. have all e-mail “From:” fields set to something like “gro.etisymnull@sserpdrow” rather than the e-mail of the commenter)
  • Support for authenticating and non-authenticating SMTP servers
  • HTML in addition to plaintext ContentTypes for the message body

Special note for upgraders: If you are upgrading from a version of this plugin prior to 1.5 you will have to make note of the settings you had previously set in the wp-phpmailer.php file and re-enter them via the plugin’s new admin options page.

Installation:
  1. Unzip/unpack the plugin distribution file wp-phpmailer.zip into your wp-content/plugins/ directory.

    [Unless you wish to alternatively install the full PHPMailer yourself, then instead do this:

    1. Obtain the PHPMailer package from phpmailer.sourceforge.net
    2. Extract the contents into your wp-content/plugins/ directory (this should create a subdirectory called something like ‘phpmailer-1.72′
    3. Rename the directory created in (b.) to ‘wp-phpmailer’

    NOTE: This plugin was last tested against PHPMailer version 1.72. The plugin distribution file only contains the English-language file for PHPMailer; many other language files are available from the official PHPMailer distribution

  2. [Skip this step unless you chose to install PHPMailer yourself]
    Copy the file wp-phpmailer.php from the plugin distribution file into your wp-content/plugins/wp-phpmailer/ directory
  3. Activate the plugin from your WordPress admin ‘Plugins’ page.
  4. In WordPress’s Admin section, click the Options tab. Then click the “wpPHPMailer” subtab. Adjust the configuration options to suit your situation. Be sure to change the very first option, which tells WP to use wpPHPMailer instead of the built-in mailer.

    NOTE: If you are using WP 1.5.1 or later, you do not have to do anything else. Just be aware that you cannot have more than one plugin activated that attempts to override the core WP function, wp_mail(). If you activate this plugin and do not see the “wpPHPMailer” tab under “Options” in the Admin section, then you *may* have mail plugin conflicts.

  5. For those using a version of WP prior to 1.5.1 : In the WordPress core file wp-includes/functions.php, find and replace the single occurrence of “function wp_mail(” with “function old_wp_mail(“
Functions:

function wp_mail($user, $subject, $message, $headers, $htmlmessage='')

This is a helper function that retrieves the URL of the image for a specified category. Returns ” if no image was found:

  • $user : The user sending the e-mail (i.e. user@host.org; “Some Guy” <user@host.org>)
  • $subject : The e-mail Subject:
  • $message : The e-mail message body, of the ContentType “text/plain” variety
  • $headers : (optional) Custom e-mail headers; default is ”
  • $htmlmessage : (optional) If defined, then the e-mail will be sent with mixed ContentTypes, a “text/html” part using $htmlmessage and an alternate “text/plain” part using $message.
Tips & Examples:

N/A

Related Links:
Release Log:
  • 29 July 2005 : v1.6 released (long delayed) — Now takes advantage of the pluggability of wp_mail() in WP 1.5.1+ so that NO core file editing is necessary to utilize this plugin; also, potentially fixed a pathname problem that occurred on Windows servers
  • 02 Apr 2005 : v1.5 released —
    • Added option page for plugin in WP’s admin section
    • Options now stored in the WP database and no longer in the plugin’s file
    • Instructions updated to pertain to WordPress v1.5
    • License changed from BSD-New to MIT
  • 17 Aug 2004 : v1.01 released — Slight fix to header handling so “From:” isn’t duplicated
  • 16 Aug 2004 : v1.0 released — Now fully compliant as drop-in replacement for mail():
    • $headers argument defaulted to ”
    • if $headers is not defined, then no choice but to use hardcoded From: values; if $headers is defined and $use_hardcoded_FROM_values is true, try to set the Reply-To: field to be header From: value (if defined)
    • defaults hardcoded e-mail address as the admin’s e-mail address; defaults From: name as “Blog Admin”
  • 27 Jul 2004 : v0.93 released — now returns boolean value to indicate success (true) or failure (false) of the mailing; a minor tweak; documentation change at the top of the file to reflect item noted in 13 Jul update. (Thanks, Will!)
  • 13 Jul 2004 : Updated documentation to reflect the need to change “mail()” call to “phpmailer()” in wp-login.php for password retrieval.
  • 11 Jul 2004 : v0.92 released — slight fix due to the boolean setting $use_hardcoded_FROM_values being used with opposite logic. Also left hardcoded From: fields uncommented (they aren’t used unless the aforementioned setting is set ‘true’. (Thanks again, Ricardo!)
  • 09 Jul 2004 : v0.91 released — fix so that root@localhost doesn’t appear as the From: field (Thanks, Ricardo!)
  • 28 Jun 2004 : v0.9 released to the public
Copyright & Disclaimer:

Copyright (c) 2004-2005 by Scott Reilly (aka coffee2code)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Acknowledgements:
I’d like to thank the PHPMailer team for creating the package this plugin merely wraps.

127 thoughts on “Plugin: wpPHPMailer

  1. I tried it on a 2.1.2 WordPress, and it doesn’t run. It appears at the “Plugins” section, I activate it, I configure it at the “Options/wpPHPMailer”, but when someone registers as a new user, doesn’t receive any e-mail.

  2. WOW! Your plugin is awesome. I’m a web designer who also resells web hosting. Just this week I set up a WordPress Blog for a client who is a teacher. I tried to register a test user but never received the email. I suspected that WordPress used the PHP sendmail function. My Windows IIS server will only send mail through SMTP authentication. I found a link to your web site after searching the WordPress forum. I immediately knew your plugin was exactly what I needed. Your instructions were easy to follow, and I just received the registration email. Thank you!!!

  3. Hey…

    I am trying to get the phpmailer all set up. But I dont know how to fill in the settings. i’m still learning all this stuff…

    SMTP mail server:
    SMTP server requires authentication? (If checked, specify authentication settings below.)
    SMTP mail username:
    SMTP mail password:
    Wordwrap length:
    Use hardcoded from values?
    Hardcoded From e-mail:
    Hardcoded From name:

    What do i put in each of these fields. Please give real examples, or tell me where i can find this info for my site…. otherwise i probably still wont get it

  4. jay: This plugin has been deprecated. (See the note I’ve added to the top of this page.) Use Configure SMTP (also linked above) instead.

Comments are closed.