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 Responses to “Plugin: wpPHPMailer”

  1. I must say…I’d been racking my brain trying to get comment notification to work before I finally found your plugin…what can I say?…thank you, thank you, thank you…it works like a champ…

  2. I installed your plugin and it’s working for almost everything. The only problem I’m having is that it won’t send lost password requests out. Instead, if gives the message “The email could not be sent.
    Possible reason: your host may have disabled the mail() function…”

    I searched wp-login.php for the @mail function, but didn’t see anything.

  3. Will,

    Thanks for the catch! In wp-login.php, the calls you want to look for are “mail(” (and not “@mail(“). There should be 2; replace them with “phpmailer(” and you should be set. I’ve updated the documentation above to reflect this additional change.

  4. Hrmm.. I changed both of them, but it’s still giving me the same error.

    Does the plugin only version of phpmailer report back to the app if the message successfully sends?

    The weird thing is that the messages are actually sending, and it seems to be changing the password in the database, but the new passwords don’t work. Don’t test this with your main admin account for your WP blog.

  5. If the mail actually got through to you, then that’s about as far as this plugin will get you. On the wordpress.org/support/ forums I’ve seen various posts about password problems. Not sure if they are in any way related to your problem or not. But if you received the e-mail about the password change, I wouldn’t think the bad password issue would arise from your use of this plugin to e-mail you your password. I could be wrong; but it doesn’t seem likely, unless the plugin were garbling the contents of the e-mails, which I haven’t witnessed myself.

  6. It looks like the wp-login script is calling the mail() function and expecting a true response if the message sent successfully. I’m just going to change that part of wp-login and hardcode it to send me a message and tell the user that I’ll change the pw asap.

    Anyway, thanks for putting this together. It really kicks ass for those of us goofy enough to host their sites on Win2k.

  7. A comment made in another post that is more appropriate here.

    Marcello said:

    Hi Scott, I’ve found your site after a (pityful) search in WP forum, ’cause I was looking for a mail script working with WP; it isn’t yet clear to me if it is a user or admin post. I mean, it allows any surfers to post to me, or the contrary?
    Second; it wille enbed its callers in the index page, or when I click the “mail” link, I’ll be brought to another page? I mean, as you know, wp works with the loop sequence; will your script affect the index page’s contents, or will be called independently?

    In my precedent layout, I build this form (it worked with cgi) to avoid nasties:
    I made hidden the msg and subject boxes (with a default writings in them) and let visible only the email field; a user had to click only 4 buttons to write in the hidden subject (with document-write.ubjectbox) field the motivation of the contact, then added the mail, and had to wait for my reply… if the subject choice were likely to my expectative (job, site, infos; no complains)
    I might sugest you an improvement to avoid smuts, no-spam and other mechanisms; a cookie checker to allow users to contact the admin only once (or twice, or more, as far as the admin has setted in the config) per day. silly people will desist.

    This plugin could be used to send mail to users, or for web-based forms for users to e-mail you. However, it would merely be the mechanism that performs the actual e-mailing. You would be the one responsible for creating and formatting the input form in a web page, ensuring that you query all the necessary information from the user, validating the information they provide, and then passing the appropriate arguments to the phpmailer() function.

    Provided you do all that (which is sounds you already do some of it), then you’d just need to make the function call (with a argument for proper headers). You don’t necessarily have to modify index.php, but you’ll need to make a page somewhere for the actual form. Then it’s up to you to create a “You web-mail has been sent” page.

    You’d also have to do the cookie-check and anti-smut comment cleansing, as this plugin doesn’t do anything but properly wrap the content for e-mailing.

    In short, you’d still have some work cut out for you, but at least you would have the ee-mailing aspect covered.

  8. Plugin updated to v0.93

    I updated the plugin so that phpmailer() returns a boolean to reflect whether sending the e-mail was successful (true) or failed (false). This addresses Will’s final problem from above.

  9. This is the error I get when I try to get a new password mailed to me… I also don’t get any other notifications… the fourth argument is that of headers I think… but I am completely clueless on this… do I have to contact my web sapce provider for this… I think it’s a windows server… could that be a problem? though it has php 4.3….please help…

    Warning: Missing argument 4 for phpmailer() in d:\public\henna\blog\wp-content\plugins\wp-phpmailer.php on line 69

    The email could not be sent.
    Possible reason: your host may have disabled the phpmailer() function…

  10. Ricardo replied on

    I am also getting the same error as henna

    I try to reset the password of a user, to test, and I get the ‘argument 4′ warning and the email received to the users email address has a blank user name and the random password… But, I can still login with the previous password for that user…

    
    Warning: Missing argument 4 for phpmailer() in c:\inetpub\wwwroot\wp-content\plugins\wp-phpmailer.php on line 69
    
    The email was sent successfully to 's email address.
    Click here to login!
    
    Warning: Missing argument 4 for phpmailer() in c:\inetpub\wwwroot\wp-content\plugins\wp-phpmailer.php on line 69
    

  11. Plugin updated to v1.0

    This release addresses an issue that didn’t quite make the function a drop-in replacement for mail(). That particuar issue was the cause of henna‘s problems, and after suggesting a fix, she tested and verified it worked. That change, and a few others, have been incorporated into this release.

    (I had actually worked the issue out with her a few days ago, but I intended to try to incorporate some other tweaks before making a new release, which is why I haven’t appeared to have followed up on the matter until now.)

    Let me know if any problems arise, as this release as a whole was fairly hot off the presses.

  12. Oye estoy enviandote esto desde coffer2code

  13. i’m having trouble finding the changes that i need to make here:

    a.) Replace all occurrences of “@mail” with “@phpmailer” in the following files:

    wp-admin/users.php (1 change)
    wp-includes/functions.php (2 changes)
    wp-register.php (1 change)

    b.) Replace occurrences of “mail(” with “phpmailer(” in wp-login.php (2 changes)

    has this been changed in WP 1.5? i can only find 1 change in functions.php, the rest don’t exist.
    Thanks.

  14. Scott replied on

    john: Yeah, the instructions have changed since WP 1.2. For WP 1.5, there is just one place in functions.php where you need to make the change from “@mail(” to “@phpmailer”. In the coming week I plan on updating this plugin with the latest instructions and some trivial tweaks. For the most part you’ll be fine with what is available now.

  15. This is probably a dumb question: what did I miss if the emails that are being sent are missing both the from: name and email address?

  16. randolph jerry replied on

    pls i need php mail.i will be glad if u can send me.thanks.randolph

  17. Have a slight problem which is probably Win2K related. I installed plugin and all wnet well until I clicked on options->wpPHPMailer. The doe not resolve correctly. I get domain.com/blog/wp-admin/c:/path_on_server_to_wp-phpmailer.php.

    I am cold fusion guy, not a PHP guy but plan on switching soon, so any help would be appreciated

  18. I’ve tested v1.5 with WP-1.5. The generated mails are a bit broken:

    There are two From headers. One is empty, the other has the expected address. The empty one seems to come from phpmailer because the Return-Path is just <> (ie. class.smtp.php didn’t provide an address for the MAIL FROM command).

    Content-Type also shows up twice. Once with charset UTF-8 (from WP), and once with iso-8859-1 (from phpmailer).
    phpmailer also sets a Content-Transfer-Encoding header. That’s good but it clashes with one of the Content-Type headers (8bit is OK for iso-8859-1 but not UTF-8).
    (Strangely, vanilla WP doesn’t encode the subject and body and doesn’t set a Content-Transfer-Encoding header. Makes me wonder how it wants to handle UTF-8 stuff outside the ASCII range)

    MIME-Version: 1.0 shows up twice too.

  19. Chris replied on

    Having the same issue as jrees; 1.5 install goes fine until clicking the options-> wpPHPMailer. Access forbidden!
    You don’t have permission to access the requested object. It is either read-protected or not readable by the server. The address bar is cussler/wordpress/wp-admin/C:/TSW/Apache2/htdocs/wordpress/wp-content/plugins/wp-phpmailer/wp-phpmailer.php

    Any help would be appreciated.

  20. Hi. I have the plugin installed on WordPress 1.5 and all is well except when it sends out the mail it has no sender name aor email address. What can I do to rectify this?

    Peter

  21. Morgan replied on

    Having the same problem as jrees & chris. After installing the plugin (Windows 2003 server), clicking on options-> wpPHPMailer fails. The link appends the fully qualified server path to wp-phpmailer.php to the wp-admin url, like so:
    mydomain.com/wp-admin/E:%5CInetpub%5Cmydomain%5Cwp-content%5Cplugins%5Cwp-phpmailer\wp-phpmailer.php

    What should this url be?

    I’ve tried to directly access the file wp-phpmailer.php, but i get the following error:
    “Fatal error: Call to undefined function: is_plugin_page() in E:\Inetpub\morgasbord.com\wp-content\plugins\wp-phpmailer.php on line 69″

    Please help.

    Regards,

    Morgan

  22. I get “No input file specified” on mine when I try hitting the admin link for the mailer. I’m running Windows 2000 Advanced Server and php 4 with mySQL. The rest of the blog works fine.

    Is there something I should be doing differently?

  23. Scott replied on

    Anyone with problems accessing the Options page for the wpPHPMailer plugin and willing to try a one-line change:

    Locate this line, on line #144:

    add_options_page('wpPHPMailer Options', 'wpPHPMailer', 8, __FILE__); //, 'c2c_admin_phpmailer

    Change it to this:

    add_options_page('wpPHPMailer Options', 'wpPHPMailer', 8, 'wp-phpmailer/'.basename(__FILE__)); //, 'c2c_admin_phpmailer

    Does that help?

  24. Hi. I’v installed your script, and changed @mail with @phpmailer in the functions file, but when i try to make it send me my password it still tells me “The e-mail could not be sent. Possible reason: your host may have disabled the mail() function…” What have i done wrong?

  25. I’m getting the arrors below. It works, I’ve posted a comment and it’s mailed me, but you can see an error strin on my blog, in the dashboard, and when you submit a comment. What to do?
    ******

    
    Warning: open_basedir restriction in effect. File is in wrong directory in /home/httpd/vhosts/beginnermillionaire.com/subdomains/blog/httpdocs/wp-content/plugins/wp-phpmailer/wp-phpmailer.php on line 67
    
    Warning: Cannot add header information - headers already sent by (output started at /home/httpd/vhosts/beginnermillionaire.com/subdomains/blog/httpdocs/wp-content/plugins/wp-phpmailer/wp-phpmailer.php:67) in /home/httpd/vhosts/beginnermillionaire.com/subdomains/blog/httpdocs/wp-admin/admin.php on line 6
    
    Warning: Cannot add header information - headers already sent by (output started at /home/httpd/vhosts/beginnermillionaire.com/subdomains/blog/httpdocs/wp-content/plugins/wp-phpmailer/wp-phpmailer.php:67) in /home/httpd/vhosts/beginnermillionaire.com/subdomains/blog/httpdocs/wp-admin/admin.php on line 7
    
    Warning: Cannot add header information - headers already sent by (output started at /home/httpd/vhosts/beginnermillionaire.com/subdomains/blog/httpdocs/wp-content/plugins/wp-phpmailer/wp-phpmailer.php:67) in /home/httpd/vhosts/beginnermillionaire.com/subdomains/blog/httpdocs/wp-admin/admin.php on line 8
    
    Warning: Cannot add header information - headers already sent by (output started at /home/httpd/vhosts/beginnermillionaire.com/subdomains/blog/httpdocs/wp-content/plugins/wp-phpmailer/wp-phpmailer.php:67) in /home/httpd/vhosts/beginnermillionaire.com/subdomains/blog/httpdocs/wp-admin/admin.php on line 9

    ***********

    Thanks

  26. It appears that the last step of these instructions has changed recently. I’m using wordpress 1.5.1 and I found the wp_mail function in the wp-includes/pluggable-functions.php file.

  27. This has been fixed with 1.5.1.1
    The thing to note is, the mail function is no longer in wp-includes/functions.php but is now in wp-includes/pluggable-functions.php.

    It works most excellently with the new blog code. I’ll update my other blogs now and be happy :)

    Thanks for an excellent plugin!

  28. christian jacobsen replied on

    i can’t get this to work. i use wordpress 1.5.1.2, and i’ve changed the following file: wp-includes/pluggable-functions.php

    line 68 has been changed to the following:

    return @phpmailer($to, $subject, $message, $headers);

    this line is the only one which contains the syntax «@mail(»

    (let me just use a couple of lines to give a little rant on how frustrating it is that the documentation doesn’t reflect the current file name)

    i’ve changed options in wp to use «SMTP via wpPHPMailer» and added a valid SMTP-server, and saved the changes. however, the SMTP server does not get an SMTP call from wp when someone tries to use the e-mail function.

    when trying to register a new user, the session hangs for ~15 seconds before it displays the default text:

    # Registration Complete
    # Username: fsi83wb
    # Password: emailed to you
    # E-mail: moc.liamenull@ym
    # Login »

    when trying to retrive a forgotten password, this happenes:

    # The e-mail could not be sent.
    # Possible reason: your host may have disabled the mail() function…

    in both cases, there isn’t any attempted connections towards the SMTP server.

    what am i doing wrong?

  29. Don`t touch the wp core code anymore.
    Just activate the functions using the pluggable functions.

    just change te code of wp-phpmailer.php to add a function like this.

    
    function wp_mail ($to, $subject, $message, $headers = '') {
      return phpmailer( $to,  $subject, $message, $headers='') ; 
    }
    

    In this way you can upgrade without break anything .

    greetings work very well

  30. Massimo replied on

    I Scott,
    I followed your installatoin procedure but I could’t find the “@mail” occurence in the file wp-includes/functions.php (see step 5).
    I installed wordpress 1.5.1 (italian localized version) on Apache for win.
    Have you some suggestion?
    Thanks in advance
    Massimo

  31. Kizza replied on

    My ISP tells me:
    - – - – -
    the php mail() function has been disabled on your hosting plan

    If you wish to send mail using your WordPress site, you may need to adjust the settings for the form mailer to include the SMTP Relay for your email address.
    - – - – -
    Is this what this plugin does?
    I’ve installed it using the latest suggestions, pluggable-functions, but I still get the “mail() is disabled” error when I try to retrieve my password.

  32. Kizza replied on

    Just setting this in the wp-phpmailer.php wasn’t enough:

    
    function wp_mail ($to, $subject, $message, $headers = '') {
      return phpmailer( $to,  $subject, $message, $headers='') ;
    }
    

    I also went in an made the original wp_mail in pluggable-funtions.php a comment (rather than remove completely) and it works like a charm!

  33. Mark Pankoski replied on

    Perhaps, should be the standard install, when an SMTP server cannot be locally detected.

    wordpress.org/support/topic/36925

    Thank-you Scott.

  34. Error: please type a comment.

  35. Jeff replied on

    This works perfectly! Thanks A LOT!

  36. Jeremy replied on

    Hmmm, I’m still having a problem with the install.

    I updated wp-phpmailer.php to include function wp_mail, but that was unsuccessful. I then commented out wp_mail in pluggable-functions, and that didn’t help either.

    I’m at a bit of a loss – can anyone provide some insight?

  37. Jeffothy replied on

    Found a spelling mistake bug in the most recent version:
    Line 128 of wp-phpmailer.php
    $mail-&gt;WordWrap = $options['WordWrap'] ? $optiosn['WordWrap'] : 60;
    should be

      $mail-&gt;WordWrap = $options['WordWrap'] ? $options['WordWrap'] : 60;
    

    Not sure how I found that.

  38. So I guess I’m confused by your instructions. You say there is no other changes that need to be made after activating the plugin with the most recent release, but do certain edits need to be done in order to receive forgotten password emails, or new registration emails?

    With the default install, I am not able to receive emails via your plugin. I’ll keep messing with it, but I appreciate any assistance. Thank you in advance.

  39. Nevermind, figured it out. I know, I know, why the h@ll did you post your question so quickly, well, I don’t know. I jumped the gun.

    If your server is already setup for relay, don’t use authentication. Unchecked and worked perfectly.

    Thanks again,

    Chad

  40. The email notification plugin does not appear to send mail. I’m using phpmailer. I’ve tried changing all mail( to phpmailer( in the notification directory under plugins, but no go.

    Has anyone else using phpmailer gotten the email notification plugin to work, and what did you do?

  41. Florian replied on

    Hello and Thank you for a great plugin first of all. I’ve got the April version of wpphpmailer running just fine. When I tried to install the new version, it didn’t show up in the admin bar… No error messages though. I don’t think I use any other plugins that override wp_mail(). WP is 1.5.1.3. Any idea what could cause this behaviour? Thank you in advance and regards, Florian

  42. Awesome plugin!
    Thanks a lot for the great effort.

    I can now get email from my blog (I couldn’t before due to the server running Windows).

    Thanks again and keep up the good work.

    Cheers

    Chris

  43. Hi,

    Firstly many thanks for your plug in, I think when I get it working its going to be excatly what I need!

    I am running a windows 2003 server and am having a few problems, ie. I am still getting the The e-mail could not be sent. error.

    I am using an internal smtp IP address in the set up, which I think is fine because as soon as I change it to its external alies it tell me it cant connect.

    Any thoughts, could it be a firewall issue on port 25? I dont think its open but all other mail from other apps works, CDONTS for example.

    Cheers and thanks for all the hard work!

    Ben

  44. no thoughts? anyone?

  45. Hi,

    It seems that i have problems making the “hardcoded” settings to work, the user is always moc.niamodymnull@ehcapa

    Any suggestions on what to check?

  46. [...] Näin ollen minun täytyy seurata noita kommenttiketjuja itse käsin, eli silmin, niin kuin olisin joku haloscanilainen, mikä on turhauttavaa. Auttaisikohan wpPHPMailer tai jokin muu plugin? ? [...]

  47. Doesn’t seem to be working for me. Apache error logs keep saying
    Class 'PHPMailer' not found in wp-phpmailer.php on line 113
    Any ideas on how to fix that?

  48. Hello everyone,

    My config:
    wpPHPMailer v1.6
    WordPress 1.5.2
    Fedora Core 4

    I had two big issues to overcome to make it work. Hopefully this info will help somebody.

    1) I was getting the “your host may have disabled the mail() function” error.
    I started digging through, and found that under the covers, the code was throwing an error along the lines of “Language string failed to load: connect_host”.
    I ignored the Lang() error, and troubleshot the failed connection. Another layer deeper, I was getting a “Permission Denied (13)” on the fsockopen() call.
    I had to run system-config-securitylevel, go to the SELinux tab, open the “HTTPD Service” entry, and check the box for “Allow HTTPD scripts to connect to the network.”

    That got me to the next problem.
    2) My error messages became something along the lines of “Authentication Request denied” or some such.
    I found out that the line $mail-&gt;SMTPAuth = $options['SMTPAuth'] ? $options['SMTPAuth'] : true; always results in $mail->SMTPAuth = 1 for me, regardless of whether the Authentication box is checked in Options. So even if my smtp server doesn’t use authentication, it tries to authenticate me with blank user/pass, which fails. I changed the line to $mail-&gt;SMTPAuth = $options['SMTPAuth'] ? true : false; and it works fine.

    Thanks,
    Bo

  49. Hmm, code tags mangled my arrows… for clarification, I changed wp-phpmailer.php wp_mail() from

    $mail->SMTPAuth = $options['SMTPAuth'] ? $options['SMTPAuth'] : true;

    to

    $mail->SMTPAuth = $options['SMTPAuth'] ? true : false;

    Thanks,
    Bo

  50. Hi

    I’m using WP 1.5.2. I’ve installed the plugin as the instructions said. However I always get this message when requesting a password to be e-mailed.

     The e-mail could not be sent.
    Possible reason: your host may have disabled the mail() function... 

    Are there any changes that need to be made for it to work with with 1.5.2 ?

    Thanks for the help

  51. [...] Da auf meinem Server weder sendmail installiert war, noch ssmtp mit WordPress zur Zusammenarbeit zu bewegen war, habe ich das wpPHPMailer-Plugin installiert. [...]

  52. I installed this pluging in my “especiales” section (click on “enviar”) and it worded well after some shape adjustments. But my web is in Spanish and all the special character get messed in the email. The person receives a lot of weird characters in the post content. It´s look like the system takes the UT8-code directly but not its “value”.
    If the web were in English this pluging would work perfect.
    Does anyone know how to fix this problem?
    Thanks

  53. Im having trouble even getting this to work, i need it for regristration and for people who wish to send me a comment, ive tested both and have never recieved anything

    I used the prebuilt version, and tried SMPT server provided by Gmail and 1and1, neither want to work, the plugin is enabled ofcorse

    anychance someone can contact me for some help, thanks :)

  54. [...] Version 2.1.6 also switches mail delivery from PHP’s mail() function to the WordPress wrapper function wp_mail(). For most people, this will not result in any change whatsoever to the functioning of my plugin. But for those struggling with mail delivery issues, they can use Scott Reilly’s excellent wpPHPmailer plugin, which allows WordPress to speak SMTP directly to a mail server, instead of using the server’s sendmail command-line utility for mail delivery. I have tested subscribe2 with wpPHPmailer, and can confirm that it works quite well (at least for me!). RSS feed for comments on this post. TrackBack URI [...]

  55. Great plugin! It’d be cool though to have either a “test” button (to attempt to login to the SMTP server) or a form to fill out that sends a test e-mail all via the options page so that I know it’s working.

  56. Clint Anderson replied on

    I am getting this warning, can anyone help me out. I am just trying to register a user, and I am not getting site updates either.

    Warning: fsockopen(): unable to connect to smtp.comcast.net:25 in /home/content/t/r/e/trentstrek/html/blog/wp-content/plugins/wp-phpmailer/class.smtp.php on line 105

    Thanks,
    C

  57. Getting a Warning: fsockopen() [function.fsockopen]: php_hostconnect: connect failed in F:\hshome\cstjohn9\mydogsblog.com\blog\wp-content\plugins\class.smtp.php on line 105 and then Warning: fsockopen() [function.fsockopen]: unable to connect to :25 in F:\hshome\cstjohn9\mydogsblog.com\blog\wp-content\plugins\class.smtp.php on line 105
    ERROR
    not getting a connection to any smtp servers, i’ve tried a few, the local one for the website, gmail. I’ve tried a couple port #, but i thought 25 was the default.
    Any ideas?

  58. Great plug-in, thank you! The standard mail() function just doesn’t work on my ISP’s configuration. In the previous version of WordPress I was using I hacked the old function to make it use SMTP instead, this was a much simpler solution now I’ve upgraded to 1.5

    Cheers!

  59. I’ve got a very strange problem.
    I can only send email to my own adress (gmail)
    I’ve tried registering more gmail adresses and sending to them doesn’t work. You would think that this problem would lie with my SMTP server but changing the servers doesn’t solve my problem either. Anyone?

  60. I tried installing the plugin, but there is not item in the admin->options page after I activated it. Did I miss something?

  61. wpPHPMailer

    I am finally receiving emails when somebody posts a comment in the blog thanks to Scott Reilly and his wpPHPMailer plugin for WordPress. Instead of trying to send the notification email through sendmail, this plugin allows for an SMTP server…yay…

  62. I’m going to give this a try after some readers mentioned that they weren’t getting email notifications. It’s worth a shot. Thanks for the great plugin.

  63. great! it works..

  64. Hello,
    First of all, great plugin. Very useful for people who keep there webservers and email servers seperate. But I had a suggestion… some plugins send email to multiple recipients, such as subscribe2. It would be nice for your plugin to allow multiple recipients. I made a modification to your plugin that allowed the wp-mail function to be sent multiple addresses in the $user variable…
    line 151 after the ClearAllRecipients statement of wp-phpmailer.php

     
    if ( $user &gt; 1 ) {
                    foreach($user as $currentuser) {
                            $currentuser = trim($currentuser);
                            if (! empty($currentuser)){
                                    $mail-&gt;AddAddress($currentuser);
                            }
                    }
            } else {
                    $mail-&gt;AddAddress($user);
            }
    

    Maybe there is a better way of doing it, but just a suggestion…
    Thanks again,
    Kyle

  65. [...] First someone suggested that I install a plugin called wpPHPMailer which bypasses WordPress’ default of using PHPmail and uses Sendmail (SMTP) instead. The plugin install was simple and straightforward but I still wasn’t getting emails. [...]

  66. Just got WP 2.0 up and running on Windows 2003 and using IIS SMTP with the phpmailer and the plugin. Works great, but have the issue of no “From” address in the e-mails going out, eventhough I set one in the Admin page.. Is there a quick hack to hardcode this the right place??

    Thanks much!

  67. Hi, I’m running WordPress 2.0.1-alpha. Suddenly, tonight, my comment emailing plugin (Subscribe2) broke with this error when trying to post a comment:

    Warning: fsockopen(): unable to connect to mail.tatumweb.com:25 in /home/tatumweb/public_html/blog/wp-content/plugins/wp-phpmailer/class.smtp.php on line 105

    Warning: fsockopen(): unable to connect to tatumweb.com:25 in /home/tatumweb/public_html/blog/wp-content/plugins/wp-phpmailer/class.smtp.php on line 105

    Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/tatumweb/public_html/blog/wp-content/plugins/wp-phpmailer/class.smtp.php on line 105

    Warning: fsockopen(): unable to connect to smtp.tatumweb.com:25 in /home/tatumweb/public_html/blog/wp-content/plugins/wp-phpmailer/class.smtp.php on line 105

    Warning: Cannot modify header information – headers already sent by (output started at /home/tatumweb/public_html/blog/wp-content/plugins/wp-phpmailer/class.smtp.php:105) in /home/tatumweb/public_html/blog/wp-includes/pluggable-functions.php on line 194

    Any ideas? My SMTP server didn’t change.

    Regards,

    Rich
    BlogRodent

  68. Nevermind. I poked around and realized that my ISP is blocking unauthenticated posts via port 25. Nothing I could do would authenticate, so I checked some more and found that I needed to use a totally different port for authentication. Now it works. Thanks, and sorry for the blather.

    Rich

  69. Is this plugin compatible with WordPress 2.0?

  70. Also, does it work with PHP 4.4.1? I can’t get it to function, and my web host said to see if the script is compatible with PHP 4.4.1.

  71. Hello,

    Whatever I do, I am still getting this error:
    ================
    Warning: fsockopen(): unable to connect to mail.bellsouth.net:25 in /home/content/g/a/r/garym/html/wordpress/wp-content/plugins/class.smtp.php on line 105

    Registration Complete
    Username: testagain
    Password: emailed to you
    E-mail: ten.htuosllebnull@tset

    Login »

    =================

    I input the smtp settings that I use in my Outlook to send outgoing mail.

    Help, please!
    Thanks a lot.
    Gary

  72. jt2377 replied on

    hello, i follow the setup but i can’t active this plugin. i can’t find the wp-phpmailer under admin panel -> option.

    my server is windows 2003 web edition, iis6, php 4. did anyone got this plugin work with windows server?

  73. Greetings,
    Does this work with WP 2.0?
    I changed from the older version (1.5) to this one and now I can not send email. I tried to go back but that does not work either.
    Thanks
    BD

  74. Am I just dumb or does this not work in 2.0.1?

  75. I have been having so much trouble trying to figure out why my comments weren’t being forwarded to me… well you plugin fixed it for me. Thanks. Also thanks to the wordpress message board who sent me here, Here’s to getting problems fixed.

    cheers,

    Peter
    www.lublink.ca

  76. Anonymous replied on

    I did it as you say,but it still can’t work and disply like below:
    Parse error: parse error, unexpected T_ARRAY, expecting T_STRING in /home/vhosts/moneytalk.hf4l.com/blog/wp-content/plugins/wp-phpmailer/class.smtp.php on line 576

  77. Can somebody update this or take this project over? We would really like to see this plugin updated to work with WordPress 2.0+ installations.

  78. hello, is there a ‘idiots guide’ to all this stuff?

  79. I get this error:
    PHP Warning: fsockopen(): unable to connect to :25 in C:\hshome\jeginer\golfblog.es\blog\wp-content\plugins\phpmailer\class.smtp.php on line 105

    Any ideas?

    Thanks

  80. I also use gmail smtp but wpphpmailer doesn’t support ssl-authentication smtp?

    mail.google.com/support/bin/answer.py?answer=13278&query=smtp&topic=0&type=f&ctx=en:search

    Hope for an update?
    Thanks

  81. I also use gmail smtp but wpphpmailer doesn’t support ssl-authentication smtp?
    Hope for an update?
    Thanks

  82. [...] Then I found THIS ! Holy sh*t! Where the hell hase this plug-in been all my blogging life!!!??  [...]

  83. I was able to download and install this in about 5 minutes. I’ve only tested it with password reset emails and it seems to be working great! The hardest part was figuring out my ISP SMTP server :-) I really didn’t want to run sendmail just for blog notifications.

    Thanks for the great plugin.

  84. [...] wpPHPMailer 1.6.1 smtp ???? www.coffee2code.com/archives/2004/06/28/plugin-wpphpmailer/ [...]

  85. [...] Installed and configured the wpPHPMailer plugin, so that people actually get the password when they register. Our webhost has disabled the php mail() function so this is a good plugin. [...]

  86. [...] So that is what I did and it works like a charm. I coupled that with wpPHPMailer which sends all the normal WordPress notices via smtp and my problems were solved. [...]

  87. This works great, excxept for one problem I was having in combination with the Subscribe2 plugin.

    With hardcoded From email not checked, I was sending out subscription emails with a blank From: header. I traced it down to this (line 136 in wp-phpmailer.php):

    preg_match('|From: \"([^"]*)\" ]*)&gt;|', $headers, $fromfields);

    To get it working, I changed the regex to:

    preg_match('|From: \"?([^"]*)&gt;|', $headers, $fromfields);

    Note I made surrounding quotes around the sender name optional.

    I’ve only tested this on my install, I don’t know how robust this regex is.

  88. I’ve tried everything but am still getting no emails.
    I have WordPress 2.04 installed on a Win2k server running IIS. The server is on a DMZ along with our Linux email servers.
    I have installed wpPHPMailer no problem.
    I have activated and configured it no problem.
    I have used the internal IP address of the SMTP email server (although I have also tried it by name)
    I want people to be able to register themselves.
    Wordpress says registration has been successful and a password has been emailed but nothing arrives.
    Where can I check to see what is going wrong?

  89. For those of you getting this error:

    Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed:

    I had the same thing – just had my SMTP settings incorrect. You may want to check the same thing.

  90. I am also getting the error:
    Warning: fsockopen() [function.fsockopen]: unable to connect to pilotswap.net:25 (An established connection was aborted by the software in your host machine. ) in D:\WWW\pilotswap\wp-content\plugins\wp-phpmailer\class.smtp.php on line 105

    It WAS working until 10 Sept when Comcast decided to plug the hole I was using. As it turns out, I AM able to send mail from my client using SSL and port 465. I am not, however, smart enough to modify this plugin enough to make it use ssl and secure authentication.

    Has ANYONE done this yet? Can this be easily done? I am (unfortunately) dead in the water without a way to mail new user passwords and password reminders.

    Thanks in advance
    Pete

  91. You are my savior! I had moved to a new host, but I had no idea that the disabled the sendmail (whatever it’s called function).

    It worked with no problems. I’m thrilled.

  92. Hi!

    I’m using wp-phpmail with wp-contactform.
    But I’m still getting:

    “wp-content\plugins\wp-contact-form\wp-contactform.php on line 146″

    Which point out to:
    mail($recipient, $subject, $fullmsg, $headers);

    I don’t think wordpress recognizes change under “Mail handler:” under Options.

    Any ideas?

  93. Sorry. The warning was:

    Warning: mail(): Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set() in C:\…..\wp-content\plugins\wp-contact-form\wp-contactform.php on line 146

  94. Just installed your plug-in, everything seems to work, except that no e-mail is sent.

  95. @manne: In my poking around, I’ve found that WP-ContactForm does not support the usage of wpPHPMailer by default.

    To add support for wpPHPMailer to the WP-ContactForm plugin, open wp-contactform.php and change line 146 [ mail($recipient, $subject, $fullmsg, $headers); ] to the following:

    wp_mail($recipient, $subject, $fullmsg, $headers);

  96. cswank replied on

    I’ve installed this plugin with wordpress v. 2.0.5 and I’m not able to send mail at all. I’d also like to get this plugin to work with the wp-member plugin.

    Any help?

  97. I’m experiencing a strange problem with wp-phpmailer: when I activate it, all the pages at my site related to my blog turn into blank.
    could anybody tell me what am I missing?

  98. richiebee replied on

    Installed and enabled (do i need to enter/change values in the wp-phpmailer.php
    e.g.
    $mail->IsSMTP(); // set mailer to use SMTP

    $mail->Host = $options['Host'];
    $mail->SMTPAuth = $options['SMTPAuth'] ? $options['SMTPAuth'] : true;
    if ($mail->SMTPAuth) {
    $mail->Username = $options['Username'];
    $mail->Password = $options['Password'];

    file if so… not very clear in the installation instructions

  99. Adrian replied on

    Is this plugin work OK with WordPress 2.0?

    Thanks

    A

  100. I am using WordPress 2.05.

    I just entered localhost under SMTP mail server and it worked. I still can not get wordpress to send passwords.

  101. I need this for my blog, but my server requires pop3 before smtp authentication…. Scott, would you be able to create a second version of this utilizing the code authored by Richard Davey found at his site here: www.corephp.co.uk/archives/18-POP-before-SMTP-Authentication-for-PHPMailer.html

    I would attempt, but I admit I am not a programmer and would appreciate your time involved in doing this. Thanks Dude, awesome work on this!

  102. I use this plugin on antother site and it works really well.

  103. [...] Jako, ?e blog jest na darmowym hostingu, funkcja mail() jest niedost?pna. W zwi?zku z tym zainstalowa?em tydzie? temu wtyczk? wpPHPmailer, jako konta e-mail u?y?em w?a?nie skrzynk? z wp.pl. Skutki – prócz kilku (cudem) dostarczonych wiadomo?ci na pocz?tku, ZERO skuteczno?ci. Wywali?em wi?c konto na wp.pl z TheBat!’a i za?o?y?em nowe na o2.pl. Jak dot?d nigdy mnie nie zawiod?o i mia?bym na nim nadal swoje g?ówne konto, gdyby nie reklamy portalu. Jednak w funkcji skrzynki pomocniczej, do rozsy?ania powiadomie? spisuje si? ?wietnie – wiadomo?ci dochodz? po kilku sekundach od opublikowania komentarza. Jest tylko problem z polskimi znakami, ale dam sobie z nim rad?. Wniosek: konta e-mail na wp.pl NIE nadaj? si? do rozsy?ania powiadomie? przy korzystaniu z wtyczki PHPmailer. stycze? 13, 2007 | Inne | [...]

  104. [...] If you run any version of WordPress on a WeFaction hosted account you’ll run into the problem of sendmail being disabled so none of the notification mails get sent out. The way around this is to install the wpPHPMailer plug-in which uses SMTP instead. To get around the catch-22 of needing it installed to get your WP password, you’ll have to do the WP install, then go into phpMyAdmin and change your password using the MD5 function in the wp_users table and then login and enable the plugin and set the mail server options. [...]

  105. How to use wpPHPmailer –> WP 2.1?

    ps.: I’m a brasilian boy and I don’t speak english very well… :)

  106. I have been struggling all day to get this working with WPMU. Seems to be impossible. Any advice?

  107. [...] Por más que le he dado vueltas a la función mail() de PHP, no he sabido encontrar la causa del mal funcionamiento de Share This. Así que he optado por otra solución: instalar el plugin wpPHPMailer, y configurar el blog para que envíe correo a través de un servidor SMTP, en vez de la función mail() o wp_mail(), que es la que utiliza el plugin Share This. Todavía me queda algún cabo que atar (detalles de los campos de los correos y de la traducción), pero el invento ya carbura. [...]

  108. [...] Coincidiendo con la instalación del Comment-Policy, he decidido crear una página fija de normas de participación, nada original, por cierto, que recoge la política de La Bitácora del Tigre respecto a la aceptación de comentarios, y otra de contacto, en la que aparece un formulario destinado a acoger las intervenciones de aquellos usuarios que no desean que sus intervenciones en el blog se muestren públicamente. Para la página de contacto he estado probando diversos plugins, pero de momento no he conseguido que ninguno de ellos envíe los correos que se supone que tienen que enviar (un problema que ya tuve con el Share This, y que solventé instalando el plugin wpPHPMailer). [...]

  109. [...] wpPHPMailer by Coffee2Code. This plugin "enables WordPress to send e-mail via SMTP instead of via PHP’s mail() function (aka sendmail)." And yes, it works with WordPress 2.1.2. [...]

  110. Narcis Garcia replied on

    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.

  111. [...] that combats the issue with WordPress installs on IIS not sending registration emails. The plugin wpPHPMailer allows WordPress to use an SMTP server of your choice to send mail, instead of using the native [...]

  112. [...] Thanks for stopping by. This site is proudly powered by WordPress, MySQL, PHP, and wp-phpmailer. [...]

  113. 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!!!

  114. [...] For email handling, we found wPhpMailer. [...]

  115. [...] www.coffee2code.com/archives/2004/06/28/plugin-wpphpmailer/ [...]

  116. [...] For email handling, we found wPhpMailer. [...]

  117. [...] easily integrate the phpMailer class into your WordPress installation using a great plugin named wpPHPMailer which does all the work for [...]

  118. Thanks for some nice plugins. I look forward to testing this and a few others you’ve posted out shortly.

    :thumbsup

  119. WP 2.1.2 with this plugin confirm working! try it!

  120. [...] happy beyond belief… Finally fixed my problems with wordpress sending mail, thanks to This nifty little plugin for wordpress. Now it comes from the right address… I’ve given up on sendmail, at least for wordpress, [...]

  121. [...] by WordPress doesn’t appear to work under Windows. The solution I found is to install the wpPHPMailer plugin which allows you to configure WordPress to use any SMTP server to send the [...]

  122. [...] : télécharger et activer le plugin wpPHPMailer par Scott Reilly dans wp-content/plugins/ pour permettre à WordPress d’envoyer les [...]

  123. [...] via PHP function mail() but that they would look into it. In the mean time the tech suggested using this plugin which basically interfaces directly with an SMTP server to send out notifications and ‘lost [...]

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

  125. Scott replied on

    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.

  126. [...] but the way mail is implemented just seems bizarre. I eventually got it working, and decided to use the wpPHPMailer plugin for [...]

  127. [...] wpPHPMailer: Una alternativa al sistema de correo por defecto. Permite mandar los mensajes directamente a los hosts SMTP e incluir contenido HTML en el correo. [...]