[RC1] BetterSMTP

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Post Reply
cla
Registered User
Posts: 21
Joined: Thu Nov 24, 2005 8:22 pm

[RC1] BetterSMTP

Post by cla » Tue Nov 29, 2005 3:49 pm

MOD Title: BetterSMTP
MOD Description: A bridge to the rich, sleek and powerful SMTP functions of squirrelmail: Lets your forum send e-mails using authentication (AUTH) (none, login, plain, cram-md5, digest-md5). Additionally you can use SSL and specify non-standard SMTP ports (other than 25 that is).

Note: you don't need Squirrelmail in order to use this mod. Simply download and install – the needed files are included in the package.

MOD Version: 0.9.1
MOD Download: http://www.bytewize.com/linux/ (bottom)
Last Stable version: Not applicable

Screenshot:
Image

Could any/some of you test install this mod?


Thanks,

cla
Registered User
Posts: 21
Joined: Thu Nov 24, 2005 8:22 pm

Re: [RC1] BetterSMTP

Post by cla » Tue Nov 29, 2005 3:49 pm

NOTE: To find out WHAT protocols your smtp server supports, do this in a shell window (such as xterm):
telnet mail.server.com 25 (or whatever port)
then type
EHLO domain.com
Hopefully, you'll now get a listing of what your mailserver can handle.
If not, try
HELO domain.com

cla
Registered User
Posts: 21
Joined: Thu Nov 24, 2005 8:22 pm

Re: [RC1] BetterSMTP

Post by cla » Wed Nov 30, 2005 10:12 pm

[]
Last edited by cla on Thu Dec 01, 2005 1:14 am, edited 1 time in total.

Kulgan
Registered User
Posts: 16
Joined: Wed Nov 30, 2005 9:08 pm

Post by Kulgan » Wed Nov 30, 2005 10:12 pm

installed the mod (that went nicely :)).

however when i try it i get the following error message:

Authentication required

DEBUG MODE

Line : 129
File : smtp_squirrelmail.php

So turning on ethereal at my server to see what's actually been sent.
(trying to find out what goes wrong in the ip packet stream).

I'm using GMAIL to send mail. They Require TLS (so i turned the option on). However when tracing what data packets are send to the server. I see a welcome message from the gmail server stating that i need to STARTTLS. however the response i send is 'auth login' after which i get a message 'Must issue a STARTTLS command first' and the connection is closed.

Thinking that maybe the <yes> and <no> options might be reversed in the 'server uses Secure Authentication (SSL/TLS) option i swapped to the option 'NO' (was 'YES') and debugged the data i send again.

NO DIFFERENCES !!!
I still get the connection refused because i 'fail' to STARTTLS.

back to basics..
i use the telnet from the command line to see what would happen if i enter a STARTTLS manually after the welcome message (and there begins and ends my current STARTTLS knowledge). I get a 'go ahead' from the server. but if I try to authenticate the I get kicked :(
copy past from my cmd session:
(M = Me, C = Comp response)

C: 220 mx.gmail.com ESMTP n23sm39783nfc
M: EHLO <ip-adres>
C: 250-mx.gmail.com at your service
C:250-SIZE 20971520
C:250-8BITMIME
C:250-STARTTLS
C:250 ENHANCEDSTATUSCODES
M:STARTTLS
C:220 2.0.0 Ready to start TLS
M:AUTH LOGIN

Connection to host lost.
C:\>

(lost connection)

seems i need to get deeper in STARTTLS.
any ideas how to continue with the session after the STARTTLS cmd is given ?
or is the initiation of TLS (or SSL) handled somewhere else ?

thanks for any reply

cla
Registered User
Posts: 21
Joined: Thu Nov 24, 2005 8:22 pm

Post by cla » Thu Dec 01, 2005 1:13 am

Kulgan, first thanks for trying it out.

Doing this:
openssl s_client -crlf -connect smtp.gmail.com:25 -starttls smtp
(In linux, Mac OS X terminal or cygwin)
and then EHLO (after starttls has been issued) yields:

Code: Select all

EHLO test.com
250-mx.gmail.com at your service
250-SIZE 20971520
250-8BITMIME
250-AUTH LOGIN PLAIN
250 ENHANCEDSTATUSCODES
So provided TLS, it seems gmail supports both LOGIN and PLAIN login.

root/includes/smtp_squirrelmail/class/deliver/Deliver_SMTP.class.php, line 51 reads:

Code: Select all

if (($use_smtp_tls == true) and (check_php_version(4,3)) and (extension_loaded('openssl'))) {
            $stream = @fsockopen('tls://' . $host, $port, $errorNumber, $errorString);
It seems your php installation needs openssl in order to use secure authentication. Could this be the issue?

cla
Registered User
Posts: 21
Joined: Thu Nov 24, 2005 8:22 pm

Post by cla » Thu Dec 01, 2005 1:31 pm

Yes, the assertion in line 51 fails:
if ( ... && extension_loaded('openssl'))

unless openssl is installed.

If PHP doesn't support openssl, the mod shouldn't provide the Yes/No-checks, but instead tell the user how to enable openssl.

cla
Registered User
Posts: 21
Joined: Thu Nov 24, 2005 8:22 pm

Post by cla » Thu Dec 01, 2005 4:41 pm

cla wrote: If PHP doesn't support openssl, the mod shouldn't provide the Yes/No-checks, but instead tell the user how to enable openssl.


Ok, I've updated the mod to version 0.9.3:

0.9.3 doesn't...
* offer the Server uses Secure Authentication (SSL/TLS) if the server doesn't support openssl.
* offers a couplde of help links on authentication methods and TSL:
http://www.bytewize.com/linux/BetterSMTPhelp.php

Kulgan
Registered User
Posts: 16
Joined: Wed Nov 30, 2005 9:08 pm

Post by Kulgan » Thu Dec 01, 2005 5:03 pm

okey.. enabled the php_openssl extension (DOH that i missed that one (goes standing in a corner being ashamed 8O )

Nice 'update' on your site :p gmail only works on port 465 or 587..
I got further using port 587 with php then i got with 465 (think that's the port for outlook and 587 for other stuff)..


ow and one 'minor' typo on the site:
6. Installing PHP with openssl
There are plenty of tutorials for doing this. You can either compile php with the openssl-flag, or (if you're using windows) enable the php_openssl.php

Better chage that to enable 'extension=php_openssl.dll' in php.ini, i searched my entire machine for a file containing php_openssl.PHP.. imagine the amount of results i got :p

hmm.. still not working.. but that might be to the eeeh.. hacks i did i think..

Will try the new version later this evening (off again to visit my sister)

*EDIT1*
Well that 'trying' will not work when i get the error 'object not found' when trying to download the 'this bundle'

*EDIT2*
http://www.bytewize.com/linux/BetterSMTP.zip does work

http://www.bytewize.com/linux/bettersmtp.zip DOESN'T
(LOL @ CaSe SeNsItIvE)

Kulgan
Registered User
Posts: 16
Joined: Wed Nov 30, 2005 9:08 pm

Post by Kulgan » Thu Dec 01, 2005 5:41 pm

cla wrote: openssl s_client -crlf -connect smtp.gmail.com:25 -starttls smtp
(In linux, Mac OS X terminal or cygwin)


unfortunate I'm not using any of those 3... so no opensll command for me from the command prompt.

applied the 'new' bettersmtp mod.. but still getting the error:

Authentication required

DEBUG MODE

Line : 129
File : smtp_squirrelmail.php

and again it seems (sniffing the ip traffic) that gmail awaits the STARTTLS command or something... as if he still get's freaky at that single line
if (($use_smtp_tls == true) and (check_php_version(4,3)) and (extension_loaded('openssl')))


But i DO see the option to enable the SSL in the admin configuration panel.. so the extension is loaded..

running: PHP Version 4.4.1
and well put the 'Server uses Secure Authentication (SSL/TLS) [ help ]
' option to 'YES''

is there any way i can check if the variables are correct ?as in write the var's to a file or something just before that check is made ?? so i can see if the correct things are checked ?

cla
Registered User
Posts: 21
Joined: Thu Nov 24, 2005 8:22 pm

Post by cla » Thu Dec 01, 2005 8:02 pm

Kulgan wrote: gmail only works on port 465 or 587..


Are you sure? I can telnet smtp.gmail.com from here on all three ports (465, 587 and 25). Could it be that your port 25 is blocked? (This is sometimes done on ISP level.)
ow and one 'minor' typo on the site: /.../ enable the php_openssl.php


Gosh how n00b of me. I've changed it as you suggested. Thanks.


Hehe, sorry, I had no idea the web server was so cranky. Anyway, I've fixed the link. Thanks again!
Last edited by cla on Fri Dec 02, 2005 12:11 am, edited 1 time in total.

cla
Registered User
Posts: 21
Joined: Thu Nov 24, 2005 8:22 pm

Post by cla » Thu Dec 01, 2005 8:23 pm

unfortunate I'm not using any of those 3... so no opensll command for me from the command prompt.

Well, if you can send mail through smtp.gmail.com using your ordinary mail app using STARTTLS (Secure Authentication), then you know it should work from phpBB as well (provided they're run on the same machine).

But i DO see the option to enable the SSL in the admin configuration panel.. so the extension is loaded..


The BetterSMTP update assumes that Secure Authentication is set to false the first time. Yours probably wasn't since you've already installed it once. My fault.

Anyway, if you set Use Secure Authethentication = NO in the admin panel and click submit, it should all be back to normal (you should now be able to set Use Secure Authentication=YES if your server supports openssl).
is there any way i can check if the variables are correct?

if (($use_smtp_tls == true) and (check_php_version(4,3)) and (extension_loaded('openssl')))


If you can find this section (smtp_squirrelmail/class/deliver/Deliver_SMTP.class.php line 51) you can, temporarily, add this code immediately above that line:

Code: Select all

echo "<br>Secure Authentication is " . ($use_smtp_tls ? "ON" : "OFF");
echo "<br>My PHP version is " . (check_php_version(4,3) ? "good" : "bad");
echo "<br>OpenSSL is " . (extension_loaded('openssl') ? "LOADED" : "MISSING");
...and try sending an e-mail from within phpBB, the page presenting the error message should output:

Secure Authentication is ON
My PHP version is good
OpenSSL is LOADED

(Just remember to remove the code above once you know what's failing :> )

Kulgan
Registered User
Posts: 16
Joined: Wed Nov 30, 2005 9:08 pm

Post by Kulgan » Sun Dec 04, 2005 8:33 pm

installed openSSL (took me some darn while)..

and.. NO MORE ya need openssl message..

however...

Server uses Secure Authentication (SSL/TLS) [ help ]
WARNING: This PHP engine cannot use secure authentication!
Make sure you're running PHP version >= 4.3.0 with openssl enabled.

sigh... phpinfo gives me version 4.4.1 (eeeh ain't that >= 4.3 :p)
I added those 3 'debug' lines:

and i try to make an account..
Secure Authentication is OFF
My PHP version is good
OpenSSL is MISSING

eeeh.. okey that Secure Authentication is OFF is due to the fact 'YES' is greyed out.
My PHP version is good (huh and in admin configuration it says i need >=4.3)
and now OpenSSL is missing again......

Luckily i got some good support out here who points me into the right direction (slap would be better ;))

cla
Registered User
Posts: 21
Joined: Thu Nov 24, 2005 8:22 pm

Post by cla » Sun Dec 04, 2005 10:56 pm

Kulgan wrote: okey that Secure Authentication is OFF is due to the fact 'YES' is greyed out.
My PHP version is good (huh and in admin configuration it says i need >=4.3)
and now OpenSSL is missing again......

Luckily i got some good support out here who points me into the right direction (slap would be better ;))


If PHP would recognize OpenSSL, both of these problems would be resolved. I've never run PHP with OpenSSL myself, so I have no idea why extension_loaded('openssl') is failing. Are you sure you installed it correctly?

Kulgan
Registered User
Posts: 16
Joined: Wed Nov 30, 2005 9:08 pm

Post by Kulgan » Mon Dec 05, 2005 5:24 pm

will check if the required files are at the correct place...

Kulgan
Registered User
Posts: 16
Joined: Wed Nov 30, 2005 9:08 pm

Post by Kulgan » Mon Dec 05, 2005 6:35 pm

??????

Since i got that 'warning ya need php 4.3 >= etc' i dumped php 4.4 and installed 5.1.1 ;)

Offcourse all kinds of settinsg didn't work (error in mysql.php AAARGH).. so i had to re-fix my php.ini (which was appearantly a mess since it sed to work but not anymore).

and now when i run phpinfo() i see the openssl module:
openssl
OpenSSL support enabled
OpenSSL Version OpenSSL 0.9.8a 11 Oct 2005

and i didn't see that before.
think the 'sneaky' part was in the line:
extension_dir = "<your_php_dir>\ext\"
which pointed to ./ but that was appearantly wrong (since openssl didn't load).
no clue what it pointed to.... but it now is correct :)

now to experiment with it (crosses fingers)

Post Reply

Return to “[2.0.x] MODs in Development”