delphi - 使用 Indy 和 ContentType = 'multipart/mixed' 发送电子邮件的问题
问题描述
我使用下面的代码从使用 Indy 的 Delphi 应用程序发送电子邮件。
我刚刚离开了我日常工作的核心部分:
MailMessage.From.Name:= UserName;
MailMessage.Encoding := meDefault;
MailMessage.Subject := MessageObject;
with TIdText.Create(MailMessage.MessageParts, nil) do begin
ContentType := 'multipart/alternative';
end;
with TIdText.Create(MailMessage.MessageParts, nil) do
begin
Body.Text:= MessageText; // MessageText could be eithr HTML or TEXT
ContentType := 'text/html';
end;
// recipients lists are populated
PrepareToList;
PrepareccList;
PrepareBccList;
// attachments are added to the MailMessage
AddAttachments;
MailMessage.ContentType := 'multipart/mixed';
//usage of TIdSMTP to send mail
SMTP.Connect;
SMTP.Send(MailMessage);
上面的代码不知何故适用于大多数 SMTP 服务器,在 Outlook 中收到的消息如下所示:
...但是当我使用特定的“有问题”的 SMTP 服务器时,我看到:
第一种情况正常,第二种情况很奇怪。
奇怪的是,当使用特定的 SMTP 服务器时,我重现了这个问题,其他的都很好。
您能否给我一些提示以进一步了解发生了什么?
解决方案
推荐阅读
- c# - 如何从 StringValue 属性的值解析枚举
- xml - 是什么意思
- javascript - D3:从数组中获取值
- python - 模块 'shapely' 没有属性 'geometry' 错误
- html - jsPDF html方法总是失败
- javascript - 在 Qualtrics 中写入和读取 Cookie 的值
- python - 如何在 Instagram 上的 chrome 移动视图中获取 .click(),而不是右键单击 - [Instagram 上的 Selenium]
- microsoft-teams - 微软流程自适应卡在团队中提及团队用户
- html - 如何禁止 robots.txt 中的特定子文件夹?
- django - Elasticsearch dsl 添加外键