以前的笔记或摘录: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.
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.
相关文章推荐
- 【安全牛学习笔记】思路、身份认证方法、密码破解方法、字典
- 【安全牛学习笔记】w3af-身份认证
- 以前的笔记或摘录: 存储网页为HTM
- Keystone身份认证--主要总结Role的相关配置
- shiro入门实战笔记(3)--身份认证
- 学习笔记之开发相关概念(7)--认证和授权
- 以前的笔记或摘录:存储网页为JPG
- 【笔记一】C++相关问题摘录
- Shiro 学习笔记(1)-Helloworld 和 身份认证
- 以前的笔记或摘录:保存网页中的所有图片
- 以前的笔记或摘录:delphi IDE的快捷键
- 以前的笔记或摘录:通过Shellexecute发送带附件的邮件
- Apache shiro 笔记整理之身份认证
- HTTP学习笔记10 用户身份认证
- Shiro学习笔记——(4)身份认证
- 以前的笔记或摘录:delphi关闭XP防火墙
- MVC4学习笔记之--身份认证过滤器
- 以前的笔记或摘录:WebBrowser中显示源代码
- Oracle 身份认证相关参数
- 以前的笔记或摘录:Get Listbox Items from a TWebBrowser Document?