delphi发送SSL 465端口邮件

Delphi 复制代码
var
 maxLinkid,hezhun,emialcom:string;
 Snno:integer;
begin


   IdMessage1.CharSet:='UTF-8' ;
   IdMessage1.ContentType := 'text/html';
   IdMessage1.Body.Clear;

   IdMessage1.From.address:=efrom.Text;

   IdMessage1.Body.Add(ebody.Text);

       IdMessage1.Recipients.EMailAddresses:=eto.text;
       IdMessage1.Subject:='IT test System';
       IdMessage1.CCList.EMailAddresses:=ecc.Text;

    try
    Screen.Cursor:=crHourGlass;

    IdSSLIOHandlerSocket1.SSLOptions.VerifyMode := [sslvTLSv32];//与服务器验证类型一致

    idsmtp1.AuthType:=satDefault;

    IdSMTP1.HeloName:='163.com';   //服务器域名
    idsmtp1.UseTLS := utUseImplicitTLS;   //支持邮件发送SS
    idsmtp1.Username:=euserid.Text;//账号 
    idsmtp1.Password:=epass.Text;//密码;
    idsmtp1.Host:=eip.Text;//'';
    idsmtp1.Port:=strtoint(eport.Text);//端口;
    idsmtp1.Connect();
    idsmtp1.Authenticate;
    idsmtp1.Send(IdMessage1);
    idsmtp1.Disconnect;

      showmessage('成功..');
      Screen.Cursor:=crDefault;
   except  on ee:exception do
   begin
      Screen.Cursor:=crDefault;
      idsmtp1.Disconnect;
      messagedlg(ee.Message,mtError,[mbOK],0);

   end;
   end;

用例下载地址:

https://download.csdn.net/download/dgthm/92589626?spm=1001.2014.3001.5503

相关推荐
人生匆匆3 天前
配置nginx ssl反向代理tcp端口
tcp/ip·nginx·ssl
学习3人组3 天前
WSS排错检查
网络协议·https·ssl
徐子元竟然被占了!!3 天前
SSL/TLS证书是
服务器·网络协议·ssl
吠品5 天前
告别异步等待!UniApp uni.getSystemInfoSync:即时获取设备信息的效率利器
https·ssl
查尔char5 天前
CentOS 7 编译安装 Python 3.10 并解决 SSL 问题
python·centos·ssl·pip·python3.11
吠品5 天前
提升效率:掌握Git Cherry-Pick,精准管理PR提交!
网络协议·https·ssl
草根站起来5 天前
OCSP中国泛域名SSL证书申请
网络·网络协议·ssl
Never_Satisfied6 天前
通过certbot安装SSL证书
网络·网络协议·ssl
yangchanghua1117 天前
Nacos如何开启ssl(https)[图文版]
服务器·https·ssl
程序猿编码8 天前
探秘 SSL/TLS 服务密码套件检测:原理、实现与核心设计(C/C++代码实现)
c语言·网络·c++·ssl·密码套件