Search The ForumSearch   RegisterRegister  LoginLogin

MailBee Objects

 AfterLogic Forum : MailBee Objects
Subject Topic: VB6 Samples sending emails to Hotmail+ Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
murfnet
Newbie
Newbie
Avatar

Joined: 07 January 2009
Location: United States
Online Status: Offline
Posts: 4
Posted: 07 January 2009 at 7:23pm | IP Logged Quote murfnet

Is there any sample code (VB6) for sending emails using an smtp.live.com (MSN Hotmail-PLUS) account using Authentication and SSL? Live.com uses port 25 rather than port 465 and using the property UseStartTLS=True does not work for me. I get [Error: SSL Init Failed] without TLS and get socket error with TLS property set true. They (live) use port 995 for POP3 and this works for me, as I can connect in, read any and all emails in the mailbox using your Mailbee POP object.

Using the SMTP object, I can send emails to gmail and other service providers, so I'm sure the code I'm using is correct, but live.com is not cooperating. Grrrr. BTW, I can send email using ms outlook 2003 and my iPhone with SMTP using the live account so the account is not locked or blocked. Here is the code I'm using:

Dim objSMTP, SSL
Set objSMTP = CreateObject("MailBee.SMTP")
objSMTP.LicenseKey = "***"
objSMTP.ServerName = "smtp.live.com"
objSMTP.EnableLogging = True
objSMTP.LogFilePath = "C:\smtp.txt"
objSMTP.ClearLog
Set SSL = CreateObject("MailBee.SSL")
SSL.LicenseKey = "***"
Set objSMTP.SSL = SSL
objSMTP.portnumber = 25
objSMTP.AuthMethod = 2 ' login auth
objSMTP.UserName = "myname@hotmail.com"
objSMTP.Password = "***"
objSMTP.FromAddr = "myname@hotmail.com"
objSMTP.ToAddr = "myname@hotmail.com"
objSMTP.Subject = "Testing HOTMAIL here"
objSMTP.BodyFormat = 0 'use 1 for html
objSMTP.BodyText = "Hello World"
If objSMTP.Send Then
MsgBox "Sent successfully"
Else
MsgBox "Error #" & objSMTP.ErrCode & ", " & objSMTP.errdesc
MsgBox "Error #" & SSL.sslerror
End If
objSMTP.Disconnect
Set SSL = Nothing
Set objSMTP = Nothing

Here is the Log File contents:

22:17:07 [MailBee SMTP v. 5.5.0.133. Registered version]
22:17:07 [Connecting to server smtp.live.com at port 25 using default domain]
22:17:07 [Initiating SSL Connection]
22:17:07 [Error: SSL Init Failed]
22:17:07 [Error: Connection failure]
22:17:09 [Error: Not connected]

Thanks to anyone that can help - Jim
Back to Top View murfnet's Profile Search for other posts by murfnet
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 08 January 2009 at 9:26am | IP Logged Quote Andrew

25 is regular SMTP port. Establishing SSL connection through that port requires STARTTLS command. So, you should use UseStartTLS=True.

465 is a dedicated SSL port, secure connection is established on connect stage, STARTTLS is not required.

If UseStartTLS=True doesn't work for you, please capture the log file with UseStartTLS=True and provide us for examination.

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
murfnet
Newbie
Newbie
Avatar

Joined: 07 January 2009
Location: United States
Online Status: Offline
Posts: 4
Posted: 08 January 2009 at 10:25am | IP Logged Quote murfnet

Here are the log details:

13:19:55 [MailBee SMTP v. 5.5.0.133. Registered version]
13:19:55 [Connecting to server smtp.live.com at port 25 using default domain]
13:19:55 [Domain specified in FromAddr, hotmail.com used]
13:19:55 [Entering ESMTP authentication mode]
13:19:55 [Sending EHLO]
13:19:55 [Error: Negative or void server response]
13:19:55 [Server responded: 502        \r\n]
13:19:55 [Possible error reason: ESMTP authentication (EHLO command) is not supported by this server]
13:19:55 [Error: Connection failure]
13:19:59 [Error: Not connected]

Thanks - Jim
Back to Top View murfnet's Profile Search for other posts by murfnet
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 08 January 2009 at 10:51am | IP Logged Quote Andrew

Thank you for the log file. It shows smtp.live.com rejects EHLO command. To use HELO instead of EHLO, just comment the following lines in your code:

Code:
objSMTP.AuthMethod = 2 ' login auth
objSMTP.UserName = "myname@hotmail.com"
objSMTP.Password = "***"


Does it help?

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
murfnet
Newbie
Newbie
Avatar

Joined: 07 January 2009
Location: United States
Online Status: Offline
Posts: 4
Posted: 08 January 2009 at 11:40am | IP Logged Quote murfnet

I commented those 3 lines out and it does not help. Here are the log details:

14:32:03 [MailBee SMTP v. 5.5.0.133. Registered version]
14:32:03 [Connecting to server smtp.live.com at port 25 using default domain]
14:32:03 [Domain specified in FromAddr, hotmail.com used]
14:32:03 [Using regular SMTP authentication]
14:32:03 [Sending HELO]
14:32:03 [Switching to SSL over regular port mode]
14:32:03 [Error: Negative or void server response]
14:32:03 [Server returned no response]
14:32:03 [Error: Connection failure]
14:32:06 [Error: Not connected]

Thanks for your help Anthony. - Jim
Back to Top View murfnet's Profile Search for other posts by murfnet
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 08 January 2009 at 12:00pm | IP Logged Quote Andrew

This means smtp.live.com doesn't support STARTTLS command. I.e. it doesn't accept secure SMTP connections through regular port.

Most probably, smtp.live.com:25 cannot be used as an SMTP relay, but can be used for local delivery (because it rejects EHLO command). For example, smtp.gmail.com doesn't allow you to relay messages through port 25, but allows that through port 465. smtp.gmail.com:25 is used by other SMTP servers to deliver mail to Gmail mailboxes.

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
murfnet
Newbie
Newbie
Avatar

Joined: 07 January 2009
Location: United States
Online Status: Offline
Posts: 4
Posted: 08 January 2009 at 3:04pm | IP Logged Quote murfnet

OK, I can read hotmail mailboxes with Mailbee but cannot send via hotmail with Mailbee due to a hotmail port 25 secure SMTP limitation on the server. I can live with that. At least I can download the emails which is the better of the two options. Thanks Anthony for your time and effort on this. - Jim
Back to Top View murfnet's Profile Search for other posts by murfnet
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide