Indy10 Hotmail 메일 수신

4298 단어 mail
hotmail은 Pop3를 개방하여 클라이언트 도구로 메일을 받을 수 있습니다.
POP 서버:pop3.live.com (포트 995) POP SSL 필요?:예 사용자 이름: Windows Live ID(예:[email protected] 암호: Windows Live ID에 대한 암호 SMTP 서버: smtp.live.com (포트 25) 인증 필요?:예. TLS/SSL이 필요합니까?:네, 그렇습니다.
indy를 사용하려면 SSL 인증이 필요합니다. 인터넷에서 찾아보면 Marco Cantú의 글을 볼 수 있습니다.
 

Send mail to GMail using Indy


 
Once you've moved your email accounts to GMail (or even entire domains), you have to fix the code you use in your Delphi programs for generating and sending email automatically. In fact, GMail uses the SMTP protocol for sending email, but with a specific form of SSH encryption called TLS .
 
To make things even more complicated, different clients use different ports and configurations. In particular, Outlook (which providees no TLS support) has different settings. For Indy, you can follow the settings used by other client programs, like those provided for Thunderbird . More info on the various ports in this newsgroup post :
Gmail uses 25, 465 and 587 for SMTP, but since almost all isps block 25, 465 is the preferred SMTP with SSL for gmail, and 587 is the preferred SMTP with TLS port.
 
Here is the code of a demo program, with the DFM file and the actual Delphi code (which is the same you'd generally use):
 
  object IdSMTP1: TIdSMTP

    OnStatus = IdSMTP1Status

    IOHandler = IdSSLIOHandlerSocketOpenSSL1

    Host = 'smtp.gmail.com'

    Password = '***'

    Port = 587

    SASLMechanisms = <>

    UseTLS = utUseExplicitTLS

    Username = '****'

  end

  object IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL

    Destination = 'smtp.gmail.com:587'

    Host = 'smtp.gmail.com'

    MaxLineAction = maException

    Port = 587

    SSLOptions.Method = sslvTLSv1

    SSLOptions.Mode = sslmUnassigned

    SSLOptions.VerifyMode = []

    SSLOptions.VerifyDepth = 0

    OnStatusInfo = IdSSLIOHandlerSocketOpenSSL1StatusInfo

  end

      

 
      IdSMTP1.Connect;

      IdSMTP1.Send(IdMessage1);

      IdSMTP1.Disconnect;

      

 
Where IdMessage1 is the message you want to send. Of course, you can both send messages to your gmail account or to any other account from you GMail account.
Notice: If you don't use "explicit TLS"you'll have to make extra initialization calls (like: IdSMTP1.SendCmd('STARTTLS', 220);). Finally, the IdSSLIOHandlerSocketOpenSSL1StatusInfo event handler produces a report like this:
      SSL status: "before/connect initialization"

      SSL status: "before/connect initialization"

      SSL status: "SSLv3 write client hello A"

      SSL status: "SSLv3 read server hello A"

      SSL status: "SSLv3 read server certificate A"

      SSL status: "SSLv3 read server done A"

      SSL status: "SSLv3 write client key exchange A"

      SSL status: "SSLv3 write change cipher spec A"

      SSL status: "SSLv3 write finished A"

      SSL status: "SSLv3 flush data"

      SSL status: "SSLv3 read finished A"

      SSL status: "SSL negotiation finished successfully"

      status: "SSL negotiation finished successfully"

      Cipher: name = [...]; description = [...] SSLv3 Kx=RSA Au=RSA  Enc=3DES(168)


 
 
gmail을 테스트하지 않았습니다. hotmail을 연결하는 데 오류가 발생했습니다. 나중에 반복해서 시도해 보았습니다. idpop의usetLS 속성을utUseImplicitTLS로 바꾸면 순조롭게 통과했습니다.
참고: SSL은 DLL 지원을 다운로드해야 합니다.
http://www.indyproject.org/Sockets/SSL.EN.aspx
 
주의: 서성을 켜면 메일을 받는 것이 정상적이고 메일을 보내는 데 실패하는 문제가 발생할 수 있습니다. Foxmail로 STARTLS에서 멈추고 마지막에 보내는 데 실패했습니다. 이 문제는 제가 오랫동안 괴롭혔는데 마지막에 서성의 문제입니다!

좋은 웹페이지 즐겨찾기