Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri Oct 24, 2014 6:49 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: SMTPSecureSocket and port 587
PostPosted: Mon Mar 16, 2009 11:13 am 
Offline
User avatar

Joined: Fri Oct 28, 2005 9:30 am
Posts: 86
Has anyone else had trouble getting the SMTPSecureSocket to connect to port 587, or for that matter any port other than 465? I've got a couple of customers whose ISPs require that they use port 587, even when using SSL or TLS. Problem is, the socket refuses to connect to that port with SSL/TSL enabled. If its disabled, it connects just fine. And port 465 isn't an option with these particular ISPs, since they're blocking that port.


Top
 Profile  
 
 Post subject: Re: SMTPSecureSocket and port 587
PostPosted: Fri Jul 17, 2009 11:14 pm 
Offline
User avatar

Joined: Fri Oct 28, 2005 9:30 am
Posts: 86
*Bump*


Top
 Profile  
 
 Post subject: Re: SMTPSecureSocket and port 587
PostPosted: Sat Jul 18, 2009 3:13 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 3:29 pm
Posts: 704
NeXTLoop wrote:
Has anyone else had trouble getting the SMTPSecureSocket to connect to port 587, or for that matter any port other than 465? I've got a couple of customers whose ISPs require that they use port 587, even when using SSL or TLS. Problem is, the socket refuses to connect to that port with SSL/TSL enabled. If its disabled, it connects just fine. And port 465 isn't an option with these particular ISPs, since they're blocking that port.



Well I got some possibly bad news here.

I just tested port 465 and it sent my email. When I switched to port 587, no email was sent. I tried about 30 times using different settings (it's late here, past 1am so I can try more things tomorrow) and I could never send an email using port 587 with any of the settings.

I don't know yet if it's my ISP blocking port 587 or if it's some other reason.

I tested this using Mac RB 2k9.2.1 and RB 2k9.3.

One thing we need to eliminate is if it's our ISP's blocking that port. But so far with you, me and your customer's never being able to send an email on port 587 it doesn't look good.

In RB 2k9.3 release notes there is an SMTP socket bug fix (or so they say) where it says now the SMTP socket sends emails reliably or something like that but they don't say what the bug was.

Maybe you can make a test SMTP project which uses port 465,587,etc. and let different users test their ISP's then report back to this thread?

Edit: That reminds me, RS has a demo project they could probably use.

_________________
Intel MacBook Pro OS X 10.5.7 RB Pro.


Top
 Profile  
 
 Post subject: Re: SMTPSecureSocket and port 587
PostPosted: Sat Jul 18, 2009 3:59 am 
Offline
User avatar

Joined: Fri Oct 28, 2005 9:30 am
Posts: 86
With more testing, I'm almost certain its not an issue of the port being blocked. I'm currently testing with a server that is configured to only use Port 587... and its not working.

I should also add that I've tried with both the SMTPSocket and a custom built SMTP Socket that I based off of the SSLSocket (to allow more fine-tune control). Given that both experience identical issues, if there is a problem, it would seem to be in the root class... the SSLSocket.

Having said all that, shortly before I called it quits for tonight, I may have found the key to getting it working properly. I'll post back tomorrow with more...


Top
 Profile  
 
 Post subject: Re: SMTPSecureSocket and port 587
PostPosted: Sat Jul 18, 2009 12:30 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 3:29 pm
Posts: 704
NeXTLoop wrote:
With more testing, I'm almost certain its not an issue of the port being blocked. I'm currently testing with a server that is configured to only use Port 587... and its not working.


I just tested port's 465 and 587 on a different ISP.

465 worked and 587 DID NOT.

I can say that according to a network filter I'm using RB is trying to connect on port 587 but I don't know why it isn't working or what happens after that.
I tested a SMTP Securesocket with secure=true.

I was testing with Google's gmail, what were you testing with?



NeXTLoop wrote:
Having said all that, shortly before I called it quits for tonight, I may have found the key to getting it working properly. I'll post back tomorrow with more...


Really? please share!

_________________
Intel MacBook Pro OS X 10.5.7 RB Pro.


Top
 Profile  
 
 Post subject: Re: SMTPSecureSocket and port 587
PostPosted: Sun Jul 19, 2009 9:35 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 3:29 pm
Posts: 704
286 views and no one else can test this huh?

_________________
Intel MacBook Pro OS X 10.5.7 RB Pro.


Top
 Profile  
 
 Post subject: Re: SMTPSecureSocket and port 587
PostPosted: Wed Jul 22, 2009 7:51 pm 
Offline
User avatar

Joined: Sat Nov 11, 2006 2:43 pm
Posts: 1221
Location: This poster has left the forums
can you be more specific in your question.
How is it failing? Is data going out on that port? Is the SMTP server not responding?

I just did a quick and dirty test, and port 587 could be opened for a connection, but I had nothing to connect with to test further. I have "LittleSnitch" installed and my test code tried to go out on port 587.

Have you set the ConnectionType for the correct SSL version the server is using?
Are you using RealStudio? I think you need Studio to use SSL. I have Studio so I'm not sure what happens if you compile an app with RealBasic that uses SSL - does it compile but do nothing?


Top
 Profile  
 
 Post subject: Re: SMTPSecureSocket and port 587
PostPosted: Wed Jul 22, 2009 8:26 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 3:29 pm
Posts: 704
pony wrote:
can you be more specific in your question.
How is it failing?


Hi Pony.

Thank you for trying to help.

We know it attempts to connect, that isn't the issue.

You can read some details about it here:
viewtopic.php?f=9&t=29181


This is a nasty bug that requires a real pain in the ass workaround which at this time seems to be to write a completely separate non-RB application to handle the SMTP Secure Emails.


Can SMTP secure emails be done from the OS X shell ?

Can anyone else think of another way to do SMTP secure emails on OS X without having to write a completely separate program?


Hey Aaron Ballman how about a workaround for this bug?

Since it was your code or one of your REAL Software buddies that created this bug a fix would be nice.

REAL Software may not officially want to fix this bug but a workaround fix from you Aaron would be appreciated.

If you read that link, you'll see that this bug has been around for many years and REAL Software doesn't fix it.

_________________
Intel MacBook Pro OS X 10.5.7 RB Pro.


Top
 Profile  
 
 Post subject: Re: SMTPSecureSocket and port 587
PostPosted: Fri Jul 24, 2009 3:50 pm 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
Hi,
next MBS Plugins (9.5pr7) will include a SMTPSecureSocketMBS class which allows you to change the port.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
 
 Post subject: Re: SMTPSecureSocket and port 587
PostPosted: Fri Jul 24, 2009 4:12 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 3:29 pm
Posts: 704
MonkeybreadSoftware wrote:
Hi,
next MBS Plugins (9.5pr7) will include a SMTPSecureSocketMBS class which allows you to change the port.

Greetings
Christian


UPDATE EDIT:

THE MBS SMTP Secure socket was not able to solve the problem.

Currently there is no RB coded solution for this problem that doesn't rely on some third party hack workaround.

Bug reports have been filed on on Sun, Jul 26, 2009 at 10:40 PM.


It would be nice if REAL Software would fix this.

_________________
Intel MacBook Pro OS X 10.5.7 RB Pro.


Top
 Profile  
 
 Post subject: Re: SMTPSecureSocket and port 587
PostPosted: Sun Aug 16, 2009 1:27 pm 
Offline
User avatar

Joined: Fri Oct 28, 2005 7:05 am
Posts: 565
Location: Emsworth, UK
Mo_Funds wrote:
286 views and no one else can test this huh?
The various reports about this problem finally intrigued me enough to find the time to do some poking about. To put it diplomatically, I suspected that a forum participant or two might know more about coding than about network communication.

The significance of port numbers is merely that they are used by SMTP mail servers (MTAs) to provide different protocols for different SMTP clients, which implement different protocols. The port number on which a particular server applications listen are de-facto standards, rather than ratified standards. Changing port numbers does not stop an application working. A client application which is not compatible with the server application, will of course fail to work whatever port it is listening on.

Common SMTP Ports
1. Port 25 (SMTP) is plain text. The conversation between server and client is held entirely in plain text. This is where the majority of internet MTAs are and have been since SMTP was introduced. The big problem with plain text being that user credentials and passwords are easy to intercept by sniffing the transmission media.

2. Port 465 (SMTPS) is TLS encrypted. The conversation between server and client is held entirely in encrypted text. This is probably where the internet is headed; MTAs which are 100% encrypted from initial connection onwards.

3. Port 587 (STARTTLS) is a transitional hybrid. Think of it as a special interim measure between 1 and 2. Although 'interim' on the internet likely means the next decade or so. STARTTLS is an enhanced SMTP command; an optional extension to the SMTP protocol. STARTTLS allows the MTA and client to switch (one way) from plain text to TLS encrypted transmission. STARTTLS is often provisioned on Port 25 for compatibility with either plain text or encrypted transmission. When provisioned on port 587 it is implicitly a requirement that transmission must become encrypted prior to authentication.

Using the RS SecureSocket Classes
There has been some loose talk about 'bugs' in the RB classes. After spending about a day and a half experimenting with RB against an in house Exchange server and the GMAIL servers, my conclusion is that 'Limits' and 'Bugs' are being confused. A Bug is when something does not behave as designed. A Limit is when something does not do what it was not designed to do. You may argue with my definitions, but they are the ones I am using.

The RB SMTPSecureSocket is an SMTP mail client in a class. Message management and the underlying SMTP protocol is completely obscured by a couple of very high level methods. The good news is that developers using the class can easily automate sending of complex e-mail messages without having to implement the SMTP protocol directly, PROVIDED THE MAIL SERVER IS COMPATIBLE.

SMTPSecureSocket is compatible with 1 and 2. It is not compatible with 3, because the SMTPSocket control automates the entire SMTP send process from connection to transfer. The SMTP protocol is completely hidden from the developer's view or influence. When RS developed the control they did not implement support for the STARTTLS. There is no reliable way (I have found) for a developer to intervene in the automation, so there is no (reliable) way to use the control to transfer mail to an MTA which madates clients muct use STARTTLS.

If you want compatibility with 3. you need access to the SMTP protocol, to manually crank the transmission negotiation, authentication and message transfer. Contrary to what has been said on this thread to date, it is entirely feasible using the SSLSocket. You do however need to understand the gory detail of the SMTP protocol, specifically the STARTTLS and AUTH commands.

For testing purposes I developed using RB2009R2.1 Professional on Windows Vista. The (public) test target was smtp.gmail.com on ports 25, 465 and 587. What follows is a how to complete a STARTTLS negotiation using the SSLSocket connected to port 587 of a GMAIL server.

'Connect to the target MTA unencrypted
SSLSocket.Address = "smtp.gmail.com"
SSLSocket.Port = 587
SSLSocket.ConnectionType = SSLSocket.TLSv1
SSLSocket.Secure = False
SSLSocket.Connect
...
'when connected request enhanced SMTP
SSLSocket.Write "EHLO " + cnMyHostName + chr(10)
...
'when response includes 250-STARTTLS
SSLSocket.Write "STARTTLS" +chr(10)
...
'When response includes 220 2.0.0 Ready to start TLS
SSLSocket.Secure = True
'simplified for illustration
Do
If SSLSocket.SSLConnecting Then
'SSL is being negotiated
End if
SSLSocket.Poll
Loop Until SSLSocket.SSLConnected
...

The above code snippet produces an unencrypted connection which is switched to TLS transmission by implementing the STARTTLS SMTP command. From this point on the socket can be used to send the SMTP commands needed to complete authentication and message transfer (Google is your friend). RS provide the email class, which makes subclassing the SSLSocket into a STARTTLS capable SMTPSecureSocket pretty straight forward (but well beyond the scope of my tinkering).

RS are not (in my opinion) entirely off the hook. The SSLSocket documentation in the language reference is appalling. No explanation or example is provided for using the CertificateFile and RejectionFile properties. What flippin use is "The file that contains the SSL certificate." to anyone? I also had SSL.Socket.Error firing when LastErrorCode = 301 or 303, and no mention I could find of codes > 108 in the LR. It is extremely poor on RS part, particularly as we have to pay a premium for the Pro version of RB for the privilege of using the secure socket classes.

Hope that helps and happy coding.

_________________
Yes it's me in the avatar


Top
 Profile  
 
 Post subject: Re: SMTPSecureSocket and port 587
PostPosted: Mon Aug 17, 2009 11:25 am 
Offline
User avatar

Joined: Fri Oct 28, 2005 9:30 am
Posts: 86
msssltd, you're absolutely right. A week or so ago, I started along the same process with the SecureSocket and was able to get it working.

I also think you hit the nail on the head regarding Limits vs Bugs. Like you, I think RS needs to do a better job of documenting everything. If the SMTPSocket has these limits... then say it has these limits. Then you don't waste time trying to get it working when you actually need to write your own, etc.


Top
 Profile  
 
 Post subject: Re: SMTPSecureSocket and port 587
PostPosted: Wed Sep 30, 2009 12:21 pm 
Offline

Joined: Thu Oct 05, 2006 11:45 pm
Posts: 1002
Location: Sol:Planet Earth:North America:California
Hi All,

So I am somewhat confused. Are you saying that this "bug" is not a bug and that port 587 should not work with the SMTPSecureSocket? It was also mentioned on this thread that a bug report was filed. Testing against 2009R4, of course it still will not send on port 587. I checked the new feedback app and did a search for SMTP and received 2 results. One mentions port 587 and STARTTLS and is marked as verified and fixed. It was an older report for 2008.x I see no current report. If you guys filed a report you may have to go into the new feedback system and unmark it private (I think that is what I read) so others can see it.

I am confused on this as my SMTP server can use port 587 as an alternate so you would think that it should work.

And yes the documentation for RB is severely in need of an enema! ;-)

Regards,

-Paul

_________________
This message made with 100% recycled pixels.
MacBook CD2.0/2GB/OSX 10.6.8 / REAL Studio 2010R1 Pro


Top
 Profile  
 
 Post subject: Re: SMTPSecureSocket and port 587
PostPosted: Wed Oct 07, 2009 9:27 am 
Offline
User avatar

Joined: Fri Oct 28, 2005 7:05 am
Posts: 565
Location: Emsworth, UK
paulg wrote:
So I am somewhat confused. Are you saying that this "bug" is not a bug and that port 587 should not work with the SMTPSecureSocket?
What I am saying is;
1. Port 587 is just another TCP port, the same as every other TCP port.
2. Whichever port an application protocol is bound to, both client and server must use the same application protocol.
3. The SMTPSecureSocket class does not implement the STARTTLS verb, hence it will fail to transfer mail to any MTA that mandates connecting clients implement the STARTTLS verb during transmission.

Imagine trying to talk to a fax machine. It doesn't matter what telephone number the fax happens to be listening on. The communication will always fail because you don't speak fax and the fax does not speak English. The fact that many MTAs bound to Port 587 are configured to mandate that clients implement STARTTLS is a coincidence. The sysadmins could configure STARTTLS on MTAs bound to whatever port they choose, and the SecureSMTPSocket class will still fail.

Quote:
If you guys filed a report you may have to go into the new feedback system and unmark it private (I think that is what I read) so others can see it.
I did not file as I do not consider it to be a bug. It is not a failure of design (a bug by any other name), but a limit imposed by the SecureSMTPSocket not being designed to implement the STARTTLS verb.

_________________
Yes it's me in the avatar


Top
 Profile  
 
 Post subject: Re: SMTPSecureSocket and port 587
PostPosted: Thu Jun 03, 2010 2:23 pm 
Offline
User avatar

Joined: Sat Apr 04, 2009 5:10 pm
Posts: 954
Are we able to use SMTPSecureSocket through Port 587 yet? I've just noticed that Gmail may require that you use Port 587 to send messages. They might let you use Port 25. But my ISP won't allow me to use it anyway.

_________________
Mac OS X 10.5.8/REALBasic 2008 R5.1 ~ REALBasic 2009 R4
--------------------------------------------------
Please don't use my topics in order to advertise your plug-ins.
Watch out for European spammers who try to sell plug-ins you don't even need.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group