Welcome, Guest. Please login or register.
Did you miss your activation email?
February 13, 2012, 01:26:02 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
149700 Posts in 21103 Topics by 7538 Members
Latest Member: ionline
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: [Workaround] WB SMTP Mail Won't Work w/same PHP Mailer/host as WordPress  (Read 1276 times)
donv

Offline Offline

Posts: 23



« on: February 05, 2010, 12:53:18 AM »

Hi,

I have both WB 2.8 and a WordPress blog installed on my domain.  My email is hosted by google.  I've been going crazy trying to get outbound email working with WB using a form page and in investigating things at the code level I see that both WB and WP use PHP Mailer 2.0.4.  WordPress works to send emails out but WB does not.

I notice that there are two (I believe required) settings in WordPress' set up dialog which WB does not ask for:
SMTP port (in this case requiring 465)
Secure connection prefix (ie: ssl or tls, in this case requiring ssl).

When I check the error logs in WB, there are entries like:
Code:
[04-Feb-2010 18:08:15] PHP Warning:  fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to smtp.gmail.com:25 (Connection timed out) in /home/donv/public_html/site/include/phpmailer/class.smtp.php on line 122
.

Just for trying, I hard coded the prefix and port in the class.mailer.php file for WB.  After that I no longer get any errors in the log, but the mails still do not go out.

Any ideas?  It appears there have been no successful resolution to the prior forum posts I found with similar issues, I'm hoping this might move things along.  How can I help to further debug this issue?

[Subject changed, workaround found, see reply #5 below]
« Last Edit: February 08, 2010, 06:58:12 AM by donv » Logged
doc
Guest
« Reply #1 on: February 05, 2010, 07:50:27 AM »

Hi,

there were some problems in the past with the extneral PHPMailer (mail library used by WB) when using secure SMTP connections. Not sure if this is fixed in WB 2.8 or not, never needed or tested it before.

Doc
Logged
donv

Offline Offline

Posts: 23



« Reply #2 on: February 06, 2010, 01:52:35 AM »

Thanks for your reply.  As I mentioned in my original post, a copy of the *same* PHPMailer version is used by both WordPress and WB in the installations I have to send email.  It works to send SMTP mail for WordPress but does not for WB.  This makes me think it is an issue with the WB code.

WB does not ask for/supply places to enter the port and prefix (tls/ssl) in the settings but WordPress does.  My guess is that WB is not passing the required extra variables to PHPMailer to support secured email via tls/ssl, which google requires.

I'm happy to help debug this (or even fix it if I can figure out how - don't know much PHP), I just need some help in determining what calls what to know where to look.

The PHP guide for Dummies book is on request at the library now... maybe I'll know more soon.
Logged
doc
Guest
« Reply #3 on: February 06, 2010, 08:11:05 AM »

@dony:
And as I mentioned in my first post, secure mails were never fully implemented with WB. It doesn´t matter that the PHPMailer Versions of Wordpress and WB are identical, as the WB implementation does not provide all required settings for secure SMTP mails by default. The missing tls/ssl is one part of the story.

When PHPMailer was introduced into WB, only the most commonly used options were implemented. To enable "secure SMTP" mails, one would need to add some more settings to the WB file /framework/class.wbmailer.php.

You may want to create a "bug/feature" ticket on the WB project site in order to get this fixed in future releases.

Doc
« Last Edit: February 06, 2010, 08:44:13 AM by doc » Logged
donv

Offline Offline

Posts: 23



« Reply #4 on: February 06, 2010, 09:09:38 AM »

Thanks, I get it now.  I will look at posting the bug/feature request and see if I can "fix" it in my own installation given that lead.  Thanks again.
« Last Edit: February 06, 2010, 09:12:48 AM by donv » Logged
donv

Offline Offline

Posts: 23



« Reply #5 on: February 08, 2010, 05:52:04 AM »

 rolleyes OK, apparently I did find a workaround fix for this when I hardcoded the port and connection prefix.  However, my gmail placed them in SPAM so I didn't see the mails and thought it failed.  Soooooo, here is the workaround in case someone else needs to do this, before the bug I'm about to file is resolved...

The problem is that WB does not have a place in the settings to specify the port and prefix for SMTP mail use.

In the file /wb/include/phpmailer/class.phpmailer.php, you can hardcode the default SMTP server port and connection prefix, i.e.:

on line 183 change
Code:
  var $Port        = 25;
to
Code:
  var $Port        = 465;

and on line 196 change
Code:
  var $SMTPSecure = "";
to
Code:
  var $SMTPSecure = "ssl";

This will make the connection to gmail's SMTP server go through successfully.  So long as you have a valid gmail account's sending email address and password set in the WB settings dialog, then the mail will be sent.
Logged
donv

Offline Offline

Posts: 23



« Reply #6 on: February 09, 2010, 08:06:28 PM »

Turns out a similar/related bug (feature request) was already filed (http://project.websitebaker2.org/ticket/586).  I added the port issue to that ticket and an example screenshot from WordPress.
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!