DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: cdk19821
今日帖子: 32
在线用户: 15
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 newhzlan (newhzlan) ★☆☆☆☆ -
普通会员
2017/5/5 11:43:20
标题:
delphi 10.2 idsmtp 在linux环境下运行“主题”乱码的BUG解决。 浏览:1304
加入我的收藏
楼主: 写了一个自动定时发送邮件的控制台工具,工具在windows环境下发送邮件没问题,但是在linux环境下的就会出现主题为中文时就会乱码,但正文里中文没有问题。有人遇到过吗?
代码:
function SendHtmlMail(SubjectStr, BodyStr: String): Boolean;
begin
  Result := False;
  with IdMessage do
  begin
    MessageParts.Clear;
    Subject:=SubjectStr;
    CharSet := 'UTF-8';
    ContentType := 'multipart/alternative;type="text/html"';
    ContentTransferEncoding:='base64';
  end;
  with TIdText.Create(IdMessage.MessageParts, nil) do
  begin
    Body.Text := BodyStr;
    Body.Add('<p>保密:本函件仅供指定的接收者阅读,其中可能包含特许和机密的信息,非指定接收者不得复印、散发或根据此邮件采取任何行动。若此邮件系误传,请立即联系发件人并予以销毁为宜 </p>');
    CharSet := 'UTF-8';
    ContentType := 'text/html';
    ContentTransfer:='base64';
  end;

  try
    try
      IdSMTP.Connect;
      if IdSMTP.Authenticate then
      begin
        IdSMTP.Send(IdMessage);
        Result := True;
      end;
    except
      on E: Exception do
      begin
        Log.WriteLog(E.Message, 3);
      end;
    end;
  finally
    IdSMTP.Disconnect;
  end;
end;
----------------------------------------------
96年开始用delphi3,用到现在变delphi xe3了,MIS,ERP,HRM,Mssql,Mysql...
作者:
男 newhzlan (newhzlan) ★☆☆☆☆ -
普通会员
2017/5/5 11:49:19
1楼: 初步估计应该是Linux下处理Subject主题时,对中文没有进行多字节处理。
----------------------------------------------
96年开始用delphi3,用到现在变delphi xe3了,MIS,ERP,HRM,Mssql,Mysql...
作者:
男 nevergrief (孤独骑士) ★☆☆☆☆ -
盒子活跃会员
2017/5/5 15:30:27
2楼: 你把标题转成utf8试试。内容不乱码是因为有额外的标识,id库函数帮你做过转换了。

另外好奇一下,linux下控制台程序也可以使用定时器?你又是怎么添加的?
----------------------------------------------
只有偏执狂才能生存!
作者:
男 hujiacheng ( 旺财) ★☆☆☆☆ -
普通会员
2017/5/5 17:39:56
3楼: 我在FMX。LINUX上都用了定时器。按此在新窗口浏览图片
把标题复制出来单独用 固定格式读 看正常不。 ,没图。
----------------------------------------------
免费的FTPhttps://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0/win64/zh-CN/https://cc.embarcadero.com/Author/575019>http://delphi-z.ruhttps://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0/win64/zh-CN/https://cc.embarcadero.com/Author/575019>http://delphi.icm.edu.pl/ftp/https://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0/win64/zh-CN/https://cc.embarcadero.com/Author/575019>http://delphi-z.ruhttps://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0/win64/zh-CN/https://cc.embarcadero.com/Author/575019
作者:
男 newhzlan (newhzlan) ★☆☆☆☆ -
普通会员
2017/5/18 16:10:22
4楼: 我是用的线程做的,
  StartDt := GetTickCount-600000;
  while not Terminated do
  begin
    if ((GetTickCount - StartDt)>xxxx then

跟踪了一下代码,在encodeheader时,出现无效codepage的提示
----------------------------------------------
96年开始用delphi3,用到现在变delphi xe3了,MIS,ERP,HRM,Mssql,Mysql...
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行78.125毫秒 RSS