delphi 三层 源码 中间件 框架【发送邮件】

1,可发送本文或者html类型的邮件(TCP)接口如下:

首先需要服务端的设置里面把邮件服务器的账号,密码等信息设置好。

“附件文件夹“:必须先在网盘映射里面建立对应的路径;发带附件邮件的时候,需先调用文件上传接口上传附件。

【SendEmail 邮件发送函数】范例如下:

var
  SubjectText, bodytext,FromAddress,ToAddress: string;
  CCList,BccList,AttachmentFiles,sErrorMsg: string;
begin
//组装html 格式字符串,文本就直接输入
  bodytext := '<html>' + '<body style="background-color:PowderBlue;"> ' +
    '<h1>我是简体字</h1>' +
    '<p style="font-family:times;color:green"> 繁體中國人</p> ' +
    '<p style="font-size:30px">This text is 30 pixels high</p>' +
    '</body></html>';
  //主旨
  SubjectText:='测试系统測試';
  //发送人地址
  FromAddress:='meme@163.com';
  //收件人
  ToAddress:= '123@163.com;456@163.com';
  //抄送人
  CCList:='';
  //密送
  BccList:='';
  //带后缀的附件名称 (需先调用上传文件函数上传附件)
  AttachmentFiles:='123.pdf;567.pdf' ;
  if  ser.SendEmail(SubjectText, bodytext,FromAddress,ToAddress,CCList, BccList,AttachmentFiles, sErrorMsg) then
   showmessage('邮件发送成功')
   else
     exception.Create(sErrorMsg);
end;

 源码框架下载地址:https://download.csdn.net/download/dgthm/87647460

posted @ 2023-03-14 16:43  delphix11  阅读(15)  评论(0)    收藏  举报  来源