delphi indy smtp 发送邮件


本文整理自网络,侵删。

 

  try
    idsmtp2.Username := 'abc123@163.com'; //设置登陆帐号
    idsmtp2.Password := 'abc123';// 设置登陆密码
    idsmtp2.Host:='smtp.163.com';// 设置SMTP地址

    if idsmtp2.Connected = False then
      idsmtp2.Connect;
  except
    showmessage('连接失败,请重试!');
    Exit; // 连接失败 的话 退出该执行过程
  end;

  idmsg1.Body.Clear; // 先清空上次发送的内容
  idmsg1.CharSet :='GB2312'; // 不设置这个中文会乱码
  idmsg1.Subject := 'inde insmtp 测试发送邮件'; // 设置邮件发送的标题
  idmsg1.Body.Text := '测试下邮件发送的内容!!!!' ; //设置邮件发送的主题
  idmsg1.From.Address := 'abc123@163.com'; //设置发件人
  idmsg1.Recipients.EMailAddresses :='123abc@qq.com'; //设置收件人

  try
    idsmtp2.Send(idmsg1);
    showmessage('邮件发送成功!');
  except
    showmessage('邮件发送失败!');
  end;

相关阅读 >>

Delphi10.2.3实现http异步下载

Delphi一个综合实用的单元

Delphi 程序启动后隐藏窗体和任务栏

Delphi 病毒

Delphi 禁用启用网卡

Delphi 相对路径和绝对路径的转换

Delphi 串口查询所有com口

Delphi 安卓图像压缩bitmapcompress

Delphi 从网址链接中提取域名

Delphi 让子窗体显示在任务栏上

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...