Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting to Hotmail with Indy

Status
Not open for further replies.

galcott

Programmer
Dec 29, 2009
4
0
0
US
I am creating an app where I want to be able to send email using Gmail, Yahoo or Hotmail through SMTP. I have been able to get it to work with Gmail and Yahoo, but not with Hotmail. Since SMTP access to Hotmail has only been available for a short time there doesn't seem to be much information available about how to do it.

I am using Delphi 7.0 and Indy 9.0 (TIdSMTP and TIdSSLIOHandlerSocket components). Here are the properties of those components that I am using:
Code:
  // For Gmail
  object IdSMTP_Gmail: TIdSMTP
    IOHandler = IdSSLIOHandlerSocket1
    MaxLineAction = maException
    ReadTimeout = 0
    Host = 'smtp.gmail.com'
    Port = 465
    AuthenticationType = atLogin
    Password = 'xxxx'
    Username = 'xxxx@gmail.com'
  end
 
  // For Yahoo
  object IdSMTP_Yahoo: TIdSMTP
    IOHandler = IdSSLIOHandlerSocket1
    MaxLineAction = maException
    ReadTimeout = 0
    Host = 'smtp.mail.yahoo.com'
    Port = 465
    AuthenticationType = atLogin
    Password = 'xxxx'
    Username = 'xxxx'
  end
 
  // For Hotmail
  object IdSMTP_Hotmail: TIdSMTP
    IOHandler = IdSSLIOHandlerSocket1
    MaxLineAction = maException
    ReadTimeout = 0
    Host = 'smtp.live.com'
    Port = 587
    AuthenticationType = atLogin
    Password = 'xxxx'
    Username = 'xxxx@hotmail.com'
  end
 
  // For all the above
  object IdSSLIOHandlerSocket1: TIdSSLIOHandlerSocket
    OnStatus = IdSSLIOHandlerSocket1Status
    SSLOptions.Method = sslvSSLv2
    SSLOptions.Mode = sslmUnassigned
    SSLOptions.VerifyMode = []
    SSLOptions.VerifyDepth = 0
  end

For Hotmail, I use port 587 because I found a couple of posts saying that's the correct one to use. With that port, I get an "error connecting with SSL" error when I try to connect. I tried port 465 and got "socket error #10060: connection timed out". If anyone knows the correct settings for Hotmail I would like to hear about it.

Glenn
 
Don't know how accurate this is, but here is some information I found regarding setting up Hotmail in Thunderbird.

POP: pop3.live.com
Incoming User Name: complete hotmail address
SSL is required.
Port 995.

SMTP:smtp.live.com
Outgoing User Name: complete hotmail address
TLS is required.
Port 25 if problems, use 587.

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.
 
Those are the settings I'm using for SMTP (I don't need POP), and they don't work.
 
Are you sure Indy 9 supports TLS (Transport-Layer Security), and have you enabled it? For my short research, TLS is explicitly different than SSL and requires different support. Furthermore, it seems to be indicated that Indy 10 is what supports TLS natively. For Indy 9, you have to explicitly enable it. See the thread below:


Section 12.5 of this link seems interesting, too.


Short story seems to be that you need to make sure you are supporting TLS in your program. A good start might be trying to set up an e-mail client and try to send e-mail through a Hotmail account and see what settings work (just to be sure it's your program and not the settings you are trying).

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.
 
I'm quite sure that TLS is enabled because Gmail requires it, and the Gmail connection does work. Also, the forum link you mentioned refers to the SMTPServer component, not the client. So I don't think this is the problem.
 
Actually, I'm quite sure this is your problem, since I can send e-mail quite well through Hotmail on Thunderbird. Look at the example in the second thread, which points towards what you need to be doing.

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.
 
And if you Google, STARTTLS is what you want to use there.

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top