小编ETL*_*Man的帖子

无法使用delphi indy发送UTF-8电子邮件

这是我的代码

电子邮件正文有一些unicode字符

  LSMTP := TIdSMTP.Create(nil);
  try
    LMsg := TIdMessage.Create(LSMTP);
    try
      with LMsg do
      begin
        Subject := Subj;
        Recipients.EMailAddresses := Email;    
        WriteToLog(cInformation,'To: '+Recipients.EMailAddresses);    
        From.Address := ReplaceVariables(From_Address);    
        From.Name    := ReplaceVariables(From_Name);    
        Body.Text    := EmailMessage;    
        ContentTransferEncoding := '8bit';    
        CharSet := 'UTF-8';    
        ContentType := 'text/plain';    
     end;
Run Code Online (Sandbox Code Playgroud)

这就是我得到的

Content-Type: text/plain; charset=us-ascii <<<<< WRONG
Content-Transfer-Encoding: 8bit
Date: Fri, 23 Mar 2012 17:53:19 +0000
Run Code Online (Sandbox Code Playgroud)

使用delphi 2009

delphi unicode indy

9
推荐指数
2
解决办法
8704
查看次数

标签 统计

delphi ×1

indy ×1

unicode ×1