Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Need help with the Administration of your Joomla! 1.5 site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
cyclist2918
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Sat Dec 22, 2007 5:04 pm

Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by cyclist2918 » Sun Feb 24, 2008 3:52 am

Here's a patch for Joomla-1.5.1 that allows mail to be sent through secure SMTP servers like smtp.gmail.com. It will need translation work done in the administrator/language/*.com_config.ini files. I added 2 configuration items to the mail settings, which required the addition of 4 strings:

SMTP PORT=SMTP Port
SMTP SECURITY=SMTP Security
TIPSMTPPORT=Enter the port number of your SMTP server. Use 25 for most unsecure servers, and 465 for most secure servers.
TIPSMTPSECURITY=Select the security model that your SMTP server uses.

I had to include the latest version of phpmailer, which allows the use of the SSL/TLS settings.

Here's the list of files that were changed:

administrator/components/com_config/controllers/application.php
administrator/components/com_config/views/application/tmpl/config_mail.php
administrator/language/en-GB/en-GB.com_config.ini
configuration.php
libraries/joomla/config.php
libraries/joomla/factory.php
libraries/joomla/mail/mail.php
libraries/phpmailer/phpmailer.php
libraries/phpmailer/smtp.php

The configuration.php file doesn't really need to be changed with the patch, as the new lines will be added when the global settings are changed from the administration panel. So I didn't include it.


Here's the settings you should use for gmail:

Mail from: <your.username>@gmail.com
Mailer: SMTP Server
SMTP Authentication: yes
SMTP Security: SSL
SMTP Port: 465
SMTP Username: <your.username>@gmail.com
SMTP Password: <you know the drill>
SMTP Host: smtp.gmail.com

Update: I didn't like the logic I used in the file libraries/joomla/mail/mail.php. So I've made a couple of small changes. It doesn't affect the outcome, though. I deleted the old files and put new ones in their place.
You do not have the required permissions to view the files attached to this post.

DJEd
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sun Feb 24, 2008 3:29 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by DJEd » Sun Feb 24, 2008 11:16 pm

This is great!

Thank you very much for this!

Ed
Flashback Alternatives

michelino80
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue Feb 26, 2008 4:04 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by michelino80 » Tue Feb 26, 2008 4:05 pm

Hi,
does it work with joomla 1.0.x?
could you please make it work with it?
thank you,
michele

cyclist2918
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Sat Dec 22, 2007 5:04 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by cyclist2918 » Tue Feb 26, 2008 5:07 pm

I don't have 1.0.x here, but I'm almost 100% certain that it won't work with it. I'll take a quick look to see if it could be fairly easily patched. If nothing else, I could put in a non-configuration type hack that looks at the SMTP hostname and sets the port and security model automatically. It would only work with gmail that way, though. What's keeping you from upgrading to 1.5.x?

michelino80
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue Feb 26, 2008 4:04 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by michelino80 » Tue Feb 26, 2008 5:19 pm

Hi, thanks for the answer.
Well, my webmasters say that 1.5 still need improvements. Actually the status of 1.0.x is in "mature" whilest the one of 1.5 is in "stable", so I quite agree with them.
Furthermore, many modules and templates still don't work with 1.5.
Comments to this are very appreciated! :)

bye,
michele

bambaaacha
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Sun Feb 24, 2008 2:16 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by bambaaacha » Tue Feb 26, 2008 5:55 pm

doesn't work... :(

"SMTP Error. Connection with SMTP Server failed"

cyclist2918
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Sat Dec 22, 2007 5:04 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by cyclist2918 » Tue Feb 26, 2008 7:09 pm

Alright, I looked at the code, and it seems that it's pretty simple. Probably too simple >:D . There is one caveat: I have NOT tested this code. The first thing you should do is make copies of the following files/directories:

1. Copy the directory includes/phpmailer to includes/phpmailer_orig.
2. Copy includes/joomla.php to includes/joomla.php_orig
3. Copy configuration.php to configuration.php_orig
4. Copy installation/install4.php to installation/install4.php_orig

You'll then have to edit your configuration.php and change/add the following lines: (new lines in red)

$mosConfig_smtpauth = '1';
$mosConfig_smtpuser = '<your login>@gmail.com';
$mosConfig_smtppass = '<your password>';
$mosConfig_smtphost = 'smtp.gmail.com';
$mosConfig_smtpport = '465';
$mosConfig_smtpsecure = 'ssl';


Then unpack this attached zip in your joomla base directory. If you have to remove the installation directory in 1.0.x like you have to in 1.5.x, you'll need to do it again, because I patched a file in there, too.

If this blows up your installation, just reverse those copy instructions, and you'll be set.

Here's the meat of the changes (other than the new phpmailer). (You may need this if you apply any new patches to joomla):

--- ../../joomla_orig/includes/joomla.php 2008-02-21 10:32:03.000000000 -0600
+++ joomla.php 2008-02-26 12:59:43.000000000 -0600
@@ -3865,6 +3865,7 @@
global $mosConfig_smtpauth, $mosConfig_smtpuser;
global $mosConfig_smtppass, $mosConfig_smtphost;
global $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_mailer;
+ global $mosConfig_smtpport, $mosConfig_smtpsecure;

$mail = new mosPHPMailer();

@@ -3878,10 +3879,15 @@

// Add smtp values if needed
if ( $mosConfig_mailer == 'smtp' ) {
+ $mail->IsSMTP();
$mail->SMTPAuth = $mosConfig_smtpauth;
$mail->Username = $mosConfig_smtpuser;
$mail->Password = $mosConfig_smtppass;
$mail->Host = $mosConfig_smtphost;
+ $mail->Port = $mosConfig_smtpport;
+ if ($mosConfig_smtpsecure == 'ssl' || $mosConfig_smtpsecure == 'tls') {
+ $mail->SMTPSecure = $mosConfig_smtpsecure;
+ }
} else

// Set sendmail path
You do not have the required permissions to view the files attached to this post.

cyclist2918
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Sat Dec 22, 2007 5:04 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by cyclist2918 » Tue Feb 26, 2008 7:31 pm

I sent an email to you....
bambaaacha wrote:doesn't work... :(

"SMTP Error. Connection with SMTP Server failed"

cyclist2918
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Sat Dec 22, 2007 5:04 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by cyclist2918 » Thu Feb 28, 2008 12:02 am

Make sure that ssl is enabled in your php.ini. That's why it wasn't working for bambaaacha.

bambaaacha
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Sun Feb 24, 2008 2:16 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by bambaaacha » Thu Feb 28, 2008 7:26 pm

cyclist2918 wrote:Make sure that ssl is enabled in your php.ini. That's why it wasn't working for bambaaacha.
That's right! It is now up and running thanks to cyclist2918.

bgmahesh
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Sun Dec 10, 2006 4:34 am

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by bgmahesh » Tue Mar 11, 2008 10:22 am

We have installed joomla-1.5.1-securemail.zip on Joomla 1.5.x and have changed the settings to,

Mail from: <your.username>@gmail.com
Mailer: SMTP Server
SMTP Authentication: yes
SMTP Security: SSL
SMTP Port: 465
SMTP Username: [email protected]
SMTP Password: <you know the drill>
SMTP Host: smtp.gmail.com

We are not using [email protected] but mydomain.com which is hosted with gmail. When we send out an email from the website the error we get is,

SMTP Error! Could not connect to SMTP host.

We are able to ping smtp.gmail.com. What could we be doing wrong?

regards,

cyclist2918
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Sat Dec 22, 2007 5:04 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by cyclist2918 » Tue Mar 11, 2008 1:21 pm

Check your PHP settings in the administrator panel. The item you want is under "help". Is ssl enabled?

Here's a program to test your settings with. Drop it in the base directory of your joomla installation and in your browser go to

http://your.joomla.site/joomladir/testmailer.php

It will send a mail to your account if it succeeds. It will print out some debugging messages whether it succeeds or fails.
You do not have the required permissions to view the files attached to this post.
Last edited by cyclist2918 on Tue Mar 11, 2008 9:56 pm, edited 1 time in total.

tigynet
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Feb 20, 2008 1:23 am

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by tigynet » Tue Mar 11, 2008 8:34 pm

Great patch, solved a real problem for me. Thanks!! ;D

Toxic snow0
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Thu Mar 13, 2008 1:17 am

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by Toxic snow0 » Sun Mar 16, 2008 3:21 pm

I'm running a server from home with Apache, PHP, mysql, filezilla, and Joomla 1.5 installed. I've unzipped your patch into my joomla directory. I'm using Google Apps so that i can have [email protected]. I set the global configuration mail settings to the following:
Mail from: <my.username>@mydomain.net
Mailer: SMTP Server
SMTP Authentication: yes
SMTP Security: SSL
SMTP Port: 465
SMTP Username: [email protected]
SMTP Password: <you know the drill>
SMTP Host: smtp.gmail.com

However, when i try to send an e-mail for testing i get this error: "SMTP Error! Could not connect to SMTP host."
Any idea of what I did wrong and how to fix it?

Toxic snow0
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Thu Mar 13, 2008 1:17 am

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by Toxic snow0 » Sun Mar 16, 2008 3:35 pm

i ran your testmail.php and this is what it spit back out at me.

SMTP -> ERROR: Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (31347912) Mailer Error: SMTP Error: Could not connect to SMTP host.

If I did forget to enable SSL, how do i fix that now?

cyclist2918
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Sat Dec 22, 2007 5:04 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by cyclist2918 » Mon Mar 17, 2008 1:58 pm

Check your php.ini

tombo007
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sun Mar 09, 2008 3:12 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by tombo007 » Thu Mar 20, 2008 11:41 pm

Also checked your testscript and this what it shows me:

SMTP -> FROM SERVER: SMTP -> FROM SERVER: SMTP -> ERROR: EHLO not accepted from server: SMTP -> FROM SERVER: SMTP -> ERROR: HELO not accepted from server: SMTP -> ERROR: AUTH not accepted from server: SMTP -> NOTICE: EOF caught while checking if connectedMailer Error: The following From address failed: [email protected]

If I try my Contact form on my website, it gives me this error: [email protected]

where "[email protected] " the mailadress is I entered in the form field "E-mail Adress:"

I applied the joomla-1.5.1-securemail.zip patch as posted here above.
So my mail settings in global configuration look like this:

Mail from: <your.username>@gmail.com
Mailer: SMTP Server
SMTP Authentication: yes
SMTP Security: SSL
SMTP Port: 465
SMTP Username: <your.username>@gmail.com
SMTP Password: <you know the drill>
SMTP Host: smtp.gmail.com

I hope someone comes up with a magic solution, I should have this thing up and working before monday :(

thanks a lot in advance!

cyclist2918
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Sat Dec 22, 2007 5:04 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by cyclist2918 » Fri Mar 21, 2008 2:22 am

Almost looks like the server was unresponsive for some reason. It does not look like an error from the client side.

tombo007
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sun Mar 09, 2008 3:12 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by tombo007 » Fri Mar 21, 2008 12:21 pm

so you think it could be some PHP setting that needs to be changed from the server side? Any idea what setting that could be?

cyclist2918
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Sat Dec 22, 2007 5:04 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by cyclist2918 » Fri Mar 21, 2008 3:26 pm

tombo007 wrote:so you think it could be some PHP setting that needs to be changed from the server side? Any idea what setting that could be?
I'm saying that it looks like the server smtp.gmail.com was unresponsive. phpmailer is trying to set up a handshake with the server, but it's getting no response back from it.

Double check your settings. It almost looks like you have the smtp server or port set to incorrect values in your settings or something.
Last edited by cyclist2918 on Fri Mar 21, 2008 5:42 pm, edited 1 time in total.

cyclist2918
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Sat Dec 22, 2007 5:04 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by cyclist2918 » Fri Mar 21, 2008 5:44 pm

elho wrote:??? no issue?
I didn't quite understand your question. Are you trying to use gmail's servers or not? If you don't use the file joomla.php, the port will not be changed to 465, as that's the part of joomla which sets up the email message.

tombo007
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sun Mar 09, 2008 3:12 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by tombo007 » Fri Mar 21, 2008 6:01 pm

I'm saying that it looks like the server smtp.gmail.com was unresponsive. phpmailer is trying to set up a handshake with the server, but it's getting no response back from it.

Double check your settings. It almost looks like you have the smtp server or port set to incorrect values in your settings or something.
I took a screenie from my mail-settings in global config:
Image

Hope someone spots an error in here...

nicowolf
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Thu Apr 05, 2007 7:01 am

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by nicowolf » Fri Mar 21, 2008 9:29 pm

cyclist2918 wrote:Check your PHP settings in the administrator panel. The item you want is under "help". Is ssl enabled?

Here's a program to test your settings with. Drop it in the base directory of your joomla installation and in your browser go to

http://your.joomla.site/joomladir/testmailer.php

It will send a mail to your account if it succeeds. It will print out some debugging messages whether it succeeds or fails.
Hi cyclist,

I tried to apply the patch, but it seems that you need to do this on a fresh joomla installation, since there is an installation directory inside the patch, am I correct? I was not able to login to admin backend when I applied the patch, and had to revert back to my backup. Is there a way to apply this patch to an already installed Joomla! with version 1.0.12?

Also, another point I'd like to point out is that I am using the invite plugin for CB in order to send emails, and found out that when I send the invitation to a gmail account (I mean any email address/domain hosted on gmail servers) it gets sent out fine via the "gmail-smtp-in.l.google.com". How is this possible if gmail was only accepting SSL connections?

Thanks in advance for any help... :)

cyclist2918
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Sat Dec 22, 2007 5:04 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by cyclist2918 » Sat Mar 22, 2008 2:42 pm

nicowolf wrote:
Hi cyclist,

I tried to apply the patch, but it seems that you need to do this on a fresh joomla installation, since there is an installation directory inside the patch, am I correct? I was not able to login to admin backend when I applied the patch, and had to revert back to my backup. Is there a way to apply this patch to an already installed Joomla! with version 1.0.12?

Also, another point I'd like to point out is that I am using the invite plugin for CB in order to send emails, and found out that when I send the invitation to a gmail account (I mean any email address/domain hosted on gmail servers) it gets sent out fine via the "gmail-smtp-in.l.google.com". How is this possible if gmail was only accepting SSL connections?

Thanks in advance for any help... :)
All that you have to do is remove the installation directory that is created when you apply the patch. The only thing in there is a single file, anyway. I put it in there just in case that the patch is being applied to a new installation.

The rules are different for incoming mail and relaying. It would break things if you required ssl for your incoming mail, as all smtp servers would have to connect that way. That's not the way smtp works. They're allowed to do anything they want on the client (relaying) side, though, since on the client side, you only have to communicate with one server.

cyclist2918
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Sat Dec 22, 2007 5:04 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by cyclist2918 » Sat Mar 22, 2008 2:58 pm

tombo007 wrote:
I took a screenie from my mail-settings in global config:
Image

Hope someone spots an error in here...
Based on those settings, it should be working fine. Did you apply any other patches after applying this one? It should be getting some kind of response from their server, but it's not. Maybe one of their servers is having problems. For an experiment, try hardcoding the IP address rather than the server name in your config. There's 2 of them available. Here they are:

64.233.185.109
64.233.185.111

If the first doesn't work, try the second.

Here is what I get from testmailer.php

Code: Select all

SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "220 mx.google.com ESMTP 13sm7202471wrl.39
"
SMTP -> get_lines(): $data is "220 mx.google.com ESMTP 13sm7202471wrl.39
"
SMTP -> FROM SERVER:
220 mx.google.com ESMTP 13sm7202471wrl.39
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "250-mx.google.com at your service, [97.92.217.62]
"
SMTP -> get_lines(): $data is "250-mx.google.com at your service, [97.92.217.62]
"
SMTP -> get_lines(): $data was "250-mx.google.com at your service, [97.92.217.62]
"
SMTP -> get_lines(): $str is "250-SIZE 28311552
"
SMTP -> get_lines(): $data is "250-mx.google.com at your service, [97.92.217.62]
250-SIZE 28311552
"
SMTP -> get_lines(): $data was "250-mx.google.com at your service, [97.92.217.62]
250-SIZE 28311552
"
SMTP -> get_lines(): $str is "250-8BITMIME
"
SMTP -> get_lines(): $data is "250-mx.google.com at your service, [97.92.217.62]
250-SIZE 28311552
250-8BITMIME
"
SMTP -> get_lines(): $data was "250-mx.google.com at your service, [97.92.217.62]
250-SIZE 28311552
250-8BITMIME
"
SMTP -> get_lines(): $str is "250-AUTH LOGIN PLAIN
"
SMTP -> get_lines(): $data is "250-mx.google.com at your service, [97.92.217.62]
250-SIZE 28311552
250-8BITMIME
250-AUTH LOGIN PLAIN
"
SMTP -> get_lines(): $data was "250-mx.google.com at your service, [97.92.217.62]
250-SIZE 28311552
250-8BITMIME
250-AUTH LOGIN PLAIN
"
SMTP -> get_lines(): $str is "250 ENHANCEDSTATUSCODES
"
SMTP -> get_lines(): $data is "250-mx.google.com at your service, [97.92.217.62]
250-SIZE 28311552
250-8BITMIME
250-AUTH LOGIN PLAIN
250 ENHANCEDSTATUSCODES
"
SMTP -> FROM SERVER: 
250-mx.google.com at your service, [97.92.217.62]
250-SIZE 28311552
250-8BITMIME
250-AUTH LOGIN PLAIN
250 ENHANCEDSTATUSCODES
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "334 VXNlcm5hbWU6
"
SMTP -> get_lines(): $data is "334 VXNlcm5hbWU6
"
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "334 UGFzc3dvcmQ6
"
SMTP -> get_lines(): $data is "334 UGFzc3dvcmQ6
"
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "235 2.7.0 Accepted
"
SMTP -> get_lines(): $data is "235 2.7.0 Accepted
"
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "250 2.1.0 OK
"
SMTP -> get_lines(): $data is "250 2.1.0 OK
"
SMTP -> FROM SERVER:
250 2.1.0 OK
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "250 2.1.5 OK
"
SMTP -> get_lines(): $data is "250 2.1.5 OK
"
SMTP -> FROM SERVER:
250 2.1.5 OK
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "354 Go ahead
"
SMTP -> get_lines(): $data is "354 Go ahead
"
SMTP -> FROM SERVER:
354 Go ahead
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "250 2.0.0 OK 1206198218 13sm7202471wrl.39
"
SMTP -> get_lines(): $data is "250 2.0.0 OK 1206198218 13sm7202471wrl.39
"
SMTP -> FROM SERVER:
250 2.0.0 OK 1206198218 13sm7202471wrl.39
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "221 2.0.0 mx.google.com closing connection 13sm7202471wrl.39
"
SMTP -> get_lines(): $data is "221 2.0.0 mx.google.com closing connection 13sm7202471wrl.39
"
SMTP -> FROM SERVER:
221 2.0.0 mx.google.com closing connection 13sm7202471wrl.39
Message has been sent

nicowolf
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Thu Apr 05, 2007 7:01 am

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by nicowolf » Sat Mar 22, 2008 5:10 pm

Thank you so much for all the valuable information cyclist, I will give it another try and post the results...

I manually applied the patch for the config, phpmailer, and joomla.php, I am still not able to send the invitation email. Do you think this may be because of the new version of phpmailer that was included in the patch? That is the only file that I did not patch manually. Since 1.0.12 does not allow for SSL in phpmailer, is there a way to patch this manually as well?

Thank you again for all the help... :)
Last edited by nicowolf on Sat Mar 22, 2008 6:32 pm, edited 1 time in total.

nicowolf
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Thu Apr 05, 2007 7:01 am

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by nicowolf » Sat Mar 22, 2008 5:56 pm

I applied all the patch files on my 1.0.12 Joomla! site, but I did not get an installation directory created or anything. Now I am not able to login to my administration backend, I get an error saying that the session is invalid. I am pretty sure that this is because of the joomla.php file, since the patch is for 1.0.13, which is the version when they made the changes in loging in to the site. I didn't want to quote the whole instructions where you mentioned the "meat of the changes", but assuming that the phpmailer stayed the same from 1.0.12 to 1.0.13, I can manually change the changes that you mentioned above in the changes portion which is:

--- ../../joomla_orig/includes/joomla.php 2008-02-21 10:32:03.000000000 -0600
+++ joomla.php 2008-02-26 12:59:43.000000000 -0600
@@ -3865,6 +3865,7 @@
global $mosConfig_smtpauth, $mosConfig_smtpuser;
global $mosConfig_smtppass, $mosConfig_smtphost;
global $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_mailer;
+ global $mosConfig_smtpport, $mosConfig_smtpsecure;

$mail = new mosPHPMailer();

@@ -3878,10 +3879,15 @@

// Add smtp values if needed
if ( $mosConfig_mailer == 'smtp' ) {
+ $mail->IsSMTP();
$mail->SMTPAuth = $mosConfig_smtpauth;
$mail->Username = $mosConfig_smtpuser;
$mail->Password = $mosConfig_smtppass;
$mail->Host = $mosConfig_smtphost;
+ $mail->Port = $mosConfig_smtpport;
+ if ($mosConfig_smtpsecure == 'ssl' || $mosConfig_smtpsecure == 'tls') {
+ $mail->SMTPSecure = $mosConfig_smtpsecure;
+ }
} else

// Set sendmail path

I will post the results momentarily...
Last edited by nicowolf on Sat Mar 22, 2008 6:42 pm, edited 1 time in total.

tombo007
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sun Mar 09, 2008 3:12 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by tombo007 » Sat Mar 22, 2008 6:35 pm

Based on those settings, it should be working fine. Did you apply any other patches after applying this one? It should be getting some kind of response from their server, but it's not. Maybe one of their servers is having problems. For an experiment, try hardcoding the IP address rather than the server name in your config. There's 2 of them available. Here they are:

64.233.185.109
64.233.185.111

If the first doesn't work, try the second.

Here is what I get from testmailer.php
Nothing changed, still get the same errors as stated in my first post. I'm not that experienced, maybe I'm just doing something terribly wrong that looks simple to all of you. Some suggestions what I really should check for this to work?

nicowolf
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Thu Apr 05, 2007 7:01 am

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by nicowolf » Sat Mar 22, 2008 8:43 pm

SUCCESS!!! :) I had to upgrade my joomla 1.0.12 to 1.0.15 via the patch from joomla.org download page (if you use CB, make sure to upgrade to latest CB (1.1) FIRST, or you will have problems with login). I applied the patch that cyclist provided and VIOLA! presto! My CB invite component is able to send from my GMail account via SSL connection to Hotmail and many others that almost always got blocked when I tried to send from my server directly.

Thank you cyclist for all your help! Now your patch is confirmed to work with 1.0.13 and above I believe... :D

cyclist2918
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Sat Dec 22, 2007 5:04 pm

Re: Fixes to allow using ssl/tls enabled mailservers (gmail.com)

Post by cyclist2918 » Sun Mar 23, 2008 12:23 am

nicowolf wrote:Thank you so much for all the valuable information cyclist, I will give it another try and post the results...

I manually applied the patch for the config, phpmailer, and joomla.php, I am still not able to send the invitation email. Do you think this may be because of the new version of phpmailer that was included in the patch? That is the only file that I did not patch manually. Since 1.0.12 does not allow for SSL in phpmailer, is there a way to patch this manually as well?

Thank you again for all the help... :)
The old version does not have SSL support, and the changes were way too numerous to patch it manually, so I just included the whole thing. If you add the version from the PHPMailer site, you have to rename the class inside the main program to mosPHPMailer. There is a file available somewhere that just extends the class, but it seemed like too much of a hack, especially considering that the latest version includes SSL/TLS support.


Locked

Return to “Administration 1.5”