FMX程序使用IdSMTP安卓发邮件win10的Mail接收标题乱码是为啥?

ooolinux 2019-11-10 02:47:12
FMX程序使用IdSMTP安卓发邮件win10的Mail接收标题乱码是为啥?
同一程序从win10发送win10接收则正常。
主要代码:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
//要在邮箱设置里启用smtp
IdSMTP1->Host="smtp.163.com";
IdSMTP1->Port=25;
IdSMTP1->Username="xxx@163.com";
IdSMTP1->Password="xxx";
// try
{
IdSMTP1->Connect();
// IdSMTP1->Authenticate();
}
// catch(...)
// {
// ShowMessage(u"连接服务器失败");
// return;
// }

IdMessage1->From->Address=IdSMTP1->Username;
IdMessage1->Recipients->EMailAddresses="yyy@163.com";
IdMessage1->CharSet="GBK";
IdMessage1->Subject=Edit1->Text;
// IdMessage1->Body->Text=Memo1->Text;
IdMessage1->Body->Assign(Memo1->Lines);
try
{
IdSMTP1->Send(IdMessage1);
ShowMessage(u"邮件发送成功");
}
catch(...)
{
ShowMessage(u"邮件发送失败");
}
IdSMTP1->Disconnect();
}
//---------------------------------------------------------------------------
...全文
1414 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
abc_ustone 2020-09-01
  • 打赏
  • 举报
回复
ooolinux 2020-03-10
  • 打赏
  • 举报
回复
ooolinux 2019-12-02
  • 打赏
  • 举报
回复
ooolinux 2019-12-02
  • 打赏
  • 举报
回复
引用 2 楼 早打大打打核战争 的回复:
设置ContentTransferEncoding试试
我代码加了这两句: IdMessage1->ContentTransferEncoding="8bit"; //试了 binary 等 IdMessage1->Encoding=TIdMessageEncoding::meMIME; //这句会导致win10收到的邮件内容为?????? 貌似这个属性只会改变邮件内容,对邮件标题不起作用。
ooolinux 2019-12-02
  • 打赏
  • 举报
回复
引用 2 楼 早打大打打核战争 的回复:
设置ContentTransferEncoding试试


我有空试下看。
  • 打赏
  • 举报
回复
设置ContentTransferEncoding试试

828

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧