您的位置:首页 > 其它

以前的笔记或摘录:idsmpt身份认证相关

2008-12-16 16:22 375 查看
IdSMTP1.AuthenticationType := atNone;
IdSMTP1.Connect;
try if
IdSMTP1.AuthSchemesSupported.IndexOf('LOGIN')>-1 then
begin
IdSMTP1.AuthenticationType := atLogin;
IdSMTP1.Authenticate;
end;
IdSMTP1.Send(IdMessage1);
finally
IdSMTP1.Disconnect;
end;

In Indy 10, why did you remove the UserName and Password
property from IdSMTP?
We removed it because we had to restructure the SMTP authentication. The old authentication code
worked well for over two years. Unfortunately, the code could not be expanded to fit other needs. The
original code simply used SASL (Simple Authentication and Security) and a simple SASL
authentication mechanism called LOGIN. We realized later that SASL mechanisms are reusable with
different protocols such as IdPOP3 and IMAP4. We also realized that we needed to eventually
support more secure authentication types because we know that the SASL LOGIN mechanism
provides absolutely no encryption and that there are several different types of SASL authentication in
use today such as MD5-CRAM and MD5-DIGEST that provide better encryption. To use the SASL
LOGIN mechanism, do the following:
1. Drop a TIdSASLList onto the form. It's located on the new "Indy SASL" tab.
2. In IdSMTP, set the AuthenticationType to atSASL and set the SASLMechanisms property to the
TIdSASLList you dropped in step 1.
3. Drop a TIdUserPassProvider on the form. It's located on the new "Indy SASL" tab. Set the
Username and Password property to what your user name and password.
4. Drop a TIdSASLLogin on the form and set its UserPassProvider to the TIdUserPassProvider you
dropped in step 3. It's located on the new "Indy SASL" tab.
5. Right click the TIdSASLList and Select Edit List.
6. Add the TIdSASLLogin to the list of assigned mechanisms.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: