对于多年来,我们一直在使用印10发送电子邮件(文本,而不是HTML)与连接到它的一个或多个PDF,我们从未有过任何问题。
最近(可能是因为东京发布 3 版?),我们的客户注意到电子邮件(正文)的文本部分现在是附件,而不是电子邮件本身的一部分。
我在互联网上搜索了解决方案,我测试的所有内容都没有解决这个问题。
我尝试了 Remy Lebeau 在 StackOverflow 上提出的一些解决方案,但没有成功。
这是代码(基于 StackOverflow 上的帖子)
procedure TForm1.btnSendEmailClick(Sender: TObject);
var
smtp : TIdSMTP;
msg : TidMessage;
builder: TIdMessageBuilderHtml;
begin
msg := TidMessage.Create(nil);
try
builder := TIdMessageBuilderHtml.Create();
try
// FIsBodyHtml IS FALSE
if FIsBodyHtml then begin
builder.Html.Text := edText.Lines.Text;
builder.HtmlCharSet := 'utf-8';
builder.HtmlContentTransfer := 'quoted-printable';
end else begin
builder.PlainText.Text := edText.Lines.Text;;
builder.PlainTextCharSet := 'utf-8';
builder.PlainTextContentTransfer := 'quoted-printable';
end;
// Add attached file here
if (edFile.Text <> '') and FileExists(edFile.Text) …Run Code Online (Sandbox Code Playgroud)