日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Indy10收发Hotmail邮件

發布時間:2024/4/17 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Indy10收发Hotmail邮件 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

hotmail開放了pop3,可以使用客戶端工具收取郵件了。

POP 服務器: pop3.live.com (端口 995)
需要 POP SSL?: 是的
用戶名: Windows Live ID, 比如:livesino@hotmail.com
密碼: 對應 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: TIdSMTPOnStatus = IdSMTP1StatusIOHandler = IdSSLIOHandlerSocketOpenSSL1Host = 'smtp.gmail.com'Password = '***'Port = 587SASLMechanisms = <>UseTLS = utUseExplicitTLSUsername = '****'endobject IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSLDestination = 'smtp.gmail.com:587'Host = 'smtp.gmail.com'MaxLineAction = maExceptionPort = 587SSLOptions.Method = sslvTLSv1SSLOptions.Mode = sslmUnassignedSSLOptions.VerifyMode = []SSLOptions.VerifyDepth = 0OnStatusInfo = IdSSLIOHandlerSocketOpenSSL1StatusInfoend


?

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在STARTTLS處就停止了,最后也發送失敗,這個問題我折騰了好久,最后才發現是瑞星的問題!

轉載于:https://www.cnblogs.com/GarfieldTom/archive/2009/11/06/1597092.html

與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的Indy10收发Hotmail邮件的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。