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;

相关阅读 >>

Delphi 通过进程id获取进程名

Delphi xe 中的字符串生成哈希值(md5 / sha-1 / jenkins)

Delphi 获取按键键值

Delphi 一行关键代码阻止360云查杀

Delphi代码实现窗口最小化,最大化,关闭消息发送

Delphi xe5 android 开发实现手机打电话和发短信

Delphi memo 自动滚动到最底下

Delphi 如何读取内存中的数据?

Delphi fdmemtable1 清空

Delphi中怎么判断一个文件夹是否为空

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



打赏

取消

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

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

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

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

评论

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