Categories
Package/plugin/module WordPress

Configure SMTP v3.0

I’d like to announce the official release of the updated Configure SMTP plugin (v3.0) for WordPress.

Configure SMTP mailing in WordPress, including support for sending e-mail via SSL/TLS (such as GMail).

Recommended update! This release includes a major re-implementation, more error checking, bug fixes, localization support, and more.

For more details, instructions, screenshots, and the download link, visit the plugin’s official homepage at :
coffee2code.com/wp-plugins/configure-smtp/.

Comments welcome on this post for this version of the plugin. Comments will be closed once this release has been superseded by another.

Read more for a detailed ChangeLog of the release.

Detailed ChangeLog

These are the detailed changes, some of which may or may not make sense to you depending on your familiarity with the previous features and internals of the plugin.

  • Re-implementation by extending C2C_Plugin_016, which among other things adds support for:
  • * Reset of options to default values
  • * Better sanitization of input values
  • * Offload of core/basic functionality to generic plugin framework
  • * Additional hooks for various stages/places of plugin operation
  • * Easier localization support
  • Add error checking and reporting when attempting to send test e-mail
  • Don’t configure the mailer to use SMTP if no host is provided
  • Fix localization support
  • Store plugin instance in global variable, $c2c_configure_smtp, to allow for external manipulation
  • Rename class from ‘ConfigureSMTP’ to ‘c2c_ConfigureSMTP’
  • Remove docs from top of plugin file (all that and more are in readme.txt)
  • Note compatibility with WP 3.0+
  • Minor tweaks to code formatting (spacing)
  • Add Upgrade Notice section to readme.txt
  • Add PHPDoc documentation
  • Add package info to top of file
  • Update copyright date
  • Remove trailing whitespace
  • Update screenshot
  • Update .pot file

20 replies on “Configure SMTP v3.0”

Hi, in some previous version I could set From name and mail to anything I wanted (used a form to do so, so i could reply to a sender) even with Gmail / Google Apps account. But it changed in some version. Now i see only my own mail.

Is it plugin’s “fault” or somthing changed with gmail/google apps? Is it possible to get onld behavior back? 🙂

Thanks

The plugin still allows you to configure the “From” name and email (separately). It is up to your SMTP host if they will accept those defined values. In particular, some SMTP hosts (such a GMail) will not honor the “From” email. However, the “From” name should usually be honored. I tried with GMail and as I indicated, “From” email is not honored (it’ll be your GMail address), but the “From” name will be what you set.

I have a hosting account with WebFaction and they include your SMTP plugin by default in new WordPres setups.

I suppose you already know this, but it was a nice surprise for me when I first registered with them.

Thank you for your work on this!

Thomas: Were you using a previous version of the plugin, or did you just start using it?

According to the error message, the primary problem is the “Connection timed out” bit. Either there was some intermittent network issues on your host that prevented it from connecting to GMail’s servers (in which case, try again and see if it works), or possibly (and unfortunately for you) your server may not allow outgoing connections, so your site would be prevented from contacting GMail.

You can also try to confirm that all the settings are properly set:

“Send e-mail via GMail?” is checked
“SMTP host” is smtp.gmail.com
“SMTP port” is 465
“Server connection prefix” is ssl
“Use SMTPAuth?” is checked
“SMTP Username” is your full GMail address
“SMTP Password” is your GMail password

demetris: You’re very welcome! And thanks for letting me know about the plugin’s use with WebFaction. I wasn’t aware of that until you said something.

Hi Scott,

I’m getting the following error message:

An error was encountered while trying to send the test e-mail.

SMTP Error: Could not connect to SMTP host.

Failed to connect to server
Connection refused

I have all the settings entered correctly for gmail (as you mention above to Thomas), I just installed the latest version of your plugin (today), and I am running WordPress v 2.9.2.

Any suggestions?

I tried your plugin because I couldn’t find a way to consistently get email notifications. Especially after I installed Register Plus. I wanted a way to capture new user first name, last name, etc. but it was too darn spotty.

Thanks.

I’m using GoDaddy hosting and I’m receiving this message:
An error was encountered while trying to send the test e-mail.
SMTP Error: Could not connect to SMTP host.
Failed to connect to server
Connection refused

What can I do?

Dwight, Costin: Unfortunately in some situations configuring your site to use SMTP just won’t work. It’s possible that your web host won’t permit your site to connect with the SMTP server. Some web hosts prevent client sites from opening certain types of connections which may include the SMTP ports.

Some web hosts also don’t permit web servers on their network to connect to their own mail hosts. Or in that situation it may require some different configuration options.

In a future release I will try to get the error reporting to be more informative (assuming there is more information available to report).

To be certain you may just have to contact your web host provider and ask them if they support your site’s use of SMTP to send email. Also indicate the settings you are using.

Lukman: I don’t use Hotmail so I can’t test this, but try these settings:

“Send e-mail via GMail?” is not checked
“SMTP host” is smtp.live.com
“SMTP port” is 587 (if this doesn’t work, try 25)
“Server connection prefix” is ssl (if this doesn’t work, try tls)
“Use SMTPAuth?” is checked
“SMTP Username” is your full Hotmail address
“SMTP Password” is your Hotmail password

If that doesn’t work, you’ll have to search the internet for the SMTP settings to send email via Hotmail. Or contact their customer support. Let me know how it goes.

Scott,

I am having trouble with SMTP from my shared hosting. Do you have a link handy to the documentation for WP the SMTP implementation? I can’t seem to find a link to it from the WP Codex. I am trying to understand how WP establishes SSL, and if my shared host has problems with their openssl setup.

Also, is there a debug mode available on config-smtp so I can see what error is being thrown behind the scenes?

Thanks!

-Phil (@Roadstead)

Scott,

A followup. It appears that the process stops with a “connection refused” from fsockopen on line 118 of class-smtp.php (I assume your plugin utilizes class-smtp.php)

Looks like I need to see what problems can arise with fsockopen.

Thanks,

-Phil

Scott,

Phil a third time. Does Config-SMTP append ssl:// to all smtp servers, or only when the “use gmail” box is checked.

Trying to figure out if I have to type “ssl://smtp.domain.tld” or if smtp.domain.tld is automatically concatenated with ssl://

Phil: You have to indicate the type of secure connection to use. SSL is not assumed. Specify the “Server connection prefix” dropdown to select either “ssl” or “tls” and check “Use SMTPAuth?”. You’d shouldn’t have to add the protocol as part of the host name.

Configure SMTP primarily provides an interface to configure PHPMailer, which is a standalone mail delivery library that WP has added to core.

It’s possible your shared hosting environment isn’t allowing WP to open the SMTP ports. That could lead to the “connection refused” notice. (As could invalid login credentials, invalid host name and/or port, or incorrect auth protocol.)

The plugin doesn’t currently provide any additional debugging features (other than what is reported on the page after attempting a test email), though PHPMailer may facilitate deeper debugging. I will investigate that in the next release so I can help those with issues to better identify the source of their problems.

Scott,

Thanks for clarifying the protocol append.

All of what you say about the ports is true, and its possible that google apps sendmail has blacklisted my ip range. Unfortunately I purchased hosting years ago, before I learned anything about all of this.

class-php mailer calls class-smtp.php on line 512.

I looked in ‘class-phpmailer” and on line 227 there is a boolean for debugging: $SMTPDebug whose default value is false. This looks like it is passed on line 584.

Inside class-smtp variable $do_debug is on line 55. The variable is initialized on line 80 to value 0 (not boolean false).

This variable appears to have four values: 0, 1, 2, 4 inside class-smtp even though it is commented as defined boolean, and “SMTP_Debug” is boolean.

I’m not a php programmer, so perhaps “false” gets cast as “0” into class-smtp.php. Alternatively, it appears that class-phpmailer needs to pass 0, 1, 2, 4 depending on the state of boolean SMTP_Debug). If I am correct that there is a variable problem, how would one submit the change to the wordpress developers?

If it works, then class-smtp echoes different degrees of stuff at do_debug =1 or 2, more at value 2. Value 4 is internal debug of class-smtp.php.

Since your config-smtp shows the most basic error echoes at the top of the page, I assume it should be as simple as enabling class-smtp to echo the more advanced debug details by assigning a value of 1 or 2 to do_debug in class-smtp.

Hopefully this helps you with adding some extra debug in the future, and possibly i noticed a bug in the smtp debug?

Scott,

I am convinced the problems are all on my shared hostings side. Thanks for letting me think out loud on the blog. In 6months when its time to renew hosting I will, and I will come back (and donate).

-Phil

Leave a Reply

Your email address will not be published.