Author |
|
UpsideJohn Newbie
Joined: 10 December 2009
Online Status: Offline Posts: 3
|
Posted: 10 December 2009 at 7:26am | IP Logged
|
|
|
Hi,
I am using the latest version of MailBee.net,
and am having a problem establishing a
connection to an SMTP server over TLS.
Using the exact same code, I was able to
connect to Gmail's SMTP server and
successfully send an email, and as well to the
exchange server in question, but without TLS.
Here are the logs:
[16:43:04.26] [INFO] Assembly version:
5.8.2.175.
[16:43:04.26] [INFO] Will resolve host
"devmailsvr".
[16:43:04.27] [INFO] Host "devmailsvr"
resolved to IP address(es) 192.168.10.68.
[16:43:04.27] [INFO] Will connect to host
"devmailsvr" on port 465.
[16:43:04.29] [INFO] Socket connected to IP
address 192.168.10.68 on port 465.
At this point I get an exception in the code,
IOException: The handshake failed due to an
unexpected packet format.
Here is the same code connecting to gmail:
[16:53:04.75] [INFO] Assembly version:
5.8.2.175.
[16:53:04.75] [INFO] Will resolve host
"smtp.gmail.com".
[16:53:04.83] [INFO] Host "smtp.gmail.com"
resolved to IP address(es) 74.125.47.109.
[16:53:04.83] [INFO] Will connect to host
"smtp.gmail.com" on port 465.
[16:53:04.92] [INFO] Socket connected to IP
address 74.125.47.109 on port 465.
[16:53:05.34] [RECV] 220 mx.google.com ESMTP
9sm146054ywf.50\r\n
[16:53:05.34] [INFO] Connected to mail service
at host "smtp.gmail.com" on port 465 and
ready.
[16:53:06.45] [INFO] Will send Hello command
(HELO or EHLO).
[16:53:06.45] [SEND] EHLO upsidesoft.com\r\n
[16:53:06.55] [RECV] 250-mx.google.com at your
service, [66.46.108.118]\r\n250-SIZE
35651584\r\n250-8BITMIME\r\n250-AUTH LOGIN
PLAIN\r\n250-ENHANCEDSTATUSCODES\r\n250
PIPELINING\r\n
[16:53:06.56] [INFO] SMTP Hello completed.
[16:53:07.36] [INFO] Will login as
"upsidetest".
[16:53:07.37] [INFO] Will try SASL LOGIN
authentication method.
[16:53:07.37] [SEND] AUTH LOGIN\r\n
[16:53:07.47] [RECV] 334 VXNlcm5hbWU6\r\n
[16:53:07.47] [SEND] ********\r\n
[16:53:07.56] [RECV] 334 UGFzc3dvcmQ6\r\n
[16:53:07.56] [SEND] ********\r\n
[16:53:08.03] [RECV] 235 2.7.0 Accepted\r\n
[16:53:08.03] [INFO] Logged in as
"upsidetest".
[16:53:08.03] [INFO] Will send mail message to
SMTP server "smtp.gmail.com".
[16:53:08.06] [INFO] Will submit sender and
recipients.
[16:53:08.06] [SEND] MAIL
FROM:<dev1@upsidesoft.com>\r\n
[16:53:08.06] [SEND] RCPT
TO:<john.klappstein@upsidesoft.com>\r\n
[16:53:08.14] [RECV] 250 2.1.0 OK
9sm146054ywf.50\r\n
[16:53:08.14] [RECV] 250 2.1.5 OK
9sm146054ywf.50\r\n
[16:53:08.16] [INFO] Sender and recipients
accepted by SMTP server. Will send message
data now.
[16:53:08.16] [SEND] DATA\r\n
[16:53:09.20] [RECV] 354 Go ahead
9sm146054ywf.50\r\n
[16:53:09.22] [SEND] [Data chunk of 603 bytes
sent.]
[16:53:09.22] [SEND] \r\n.\r\n
[16:53:10.20] [RECV] 250 2.0.0 OK 1260402791
9sm146054ywf.50\r\n
[16:53:10.20] [INFO] Message successfully
submitted to SMTP server.
[16:53:11.06] [SEND] QUIT\r\n
[16:53:11.16] [RECV] 221 2.0.0 closing
connection 9sm146054ywf.50\r\n
[16:53:11.16] [INFO] Will disconnect from host
"smtp.gmail.com".
[16:53:11.17] [INFO] Disconnected from host
"smtp.gmail.com".
I have also tried putting it in safe mode, but
the exact same error exists. FInally, I
configured MS outlook to use our SMTP server
over TLS and that seems to be working OK.
Any idea what could be going wrong?
Thanks,
John
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 10 December 2009 at 7:35am | IP Logged
|
|
|
There are 2 ways of connecting to SSL-enabled mail servers. One of them utilises dedicated port 465, and another one assumes using standard port 25. Try the approach described at the following Knowledge Base article:
How can I send e-mail to Gmail with C# or VB.NET
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|
UpsideJohn Newbie
Joined: 10 December 2009
Online Status: Offline Posts: 3
|
Posted: 10 December 2009 at 7:38am | IP Logged
|
|
|
Like I said, I was able to send to Gmail without
a problem. When I tried to send through my works
local exchange server, it worked using MS
Outlook, but not via MailBee.
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 10 December 2009 at 7:46am | IP Logged
|
|
|
And, it worked via port 465, not 25? As MS Outlook might use its proprietary protocol, please try sending mail to the same server with another mail client (Outlook Express, Mozilla Thunderbird) - does it work?
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|
UpsideJohn Newbie
Joined: 10 December 2009
Online Status: Offline Posts: 3
|
Posted: 10 December 2009 at 8:42am | IP Logged
|
|
|
I managed to make THunderbird work, but I had to
set it to UseStartTls. Clearly this is the
reason it didn't work.
So I retried it with UseStartTls and it
connected fine. Now the question I have is how
do I determine which mode to use (I want it to
work in either case without a user having to
specify). I could try catch both connection
methods but perhaps there is a more elegant way
to do it?
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 14 December 2009 at 6:25am | IP Logged
|
|
|
Quote:
I could try catch both connection
methods but perhaps there is a more elegant way
to do it? |
|
|
No, the only way is try both the methods and handle exception to check which one is a valid option.
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|