发送带签名的电子邮件 [英] Sending Email with signature
问题描述
我一直在使用:
ShellExecute(Self.Handle,
nil, PCHAR(format('mailto:%s ?Subject=Assunto: &Body=',[_lEmails ])),
nil,
nil,
SW_NORMAL);
发送电子邮件。
没有正文文本,因此在电子邮件客户端中具有自动签名的用户会自动获得这些签名。
to send emails. No Body text so the users that have automatic signatures in their emails clients get those automatically.
现在,我想使用户也可以插入文本,但是如果他们这样做,则文本到达那里但没有签名。
是否可以强制执行此操作。
Now I want to enable users to insert text as well, but if they do the text gets there but no signature. Is there a way to "force" this.
谢谢
推荐答案
You can use MAPI instead (the Messaging Applications Programming Interface
), which gives you much better control over the email, and allows things like attachments. You can also choose whether to show the user's email client "compose" window or add directly to the outbox. (The outbox functionality is usually restricted now because of changes to Windows security, especially where MS Outlook is concerned.)
最快,最简单的方法是使用< a href = http://wiki.delphi-jedi.org/index.php?title=JEDI_Code_Library rel = nofollow> JEDI代码库 JCLEMail
。它是SimpleMAPI的包装,使它非常容易(代码是从较旧的应用程序获取的,并且基于JCL演示的示例):
The quickest, easiest way is to use something like the JEDI Code Library JCLEMail
. It's a wrapper around SimpleMAPI, which makes it very easy (code was taken from an older app, and was based on a sample from the JCL demo):
EMail := TJclEMail.Create;
try
EMail.Recipients.Add(AnsiString(EMailAddress), AnsiString(EMailName));
EMail.Subject := AnsiString(Subject);
EMail.Body := AnsiString(Body);
EMail.HtmlBody := False; // True if it's HTML email
// Send attachment if wanted
EMail.Attachments.Add(AnsiString(FileName));
EMail.Send(True); // True to show default email, false to add to outbox
finally
EMail.Free;
end;
SimpleMAPI
的缺点是是一个短期解决方案(尽管它仍然存在于Win7 64位及更低版本中,但我不能说Windows 8)。根据 MSDN ,
The drawback to SimpleMAPI
is that it may be a short-term solution (although it's still around in Win7 64-bit and earlier, I can't speak for Windows 8). According to MSDN,
[不建议使用简单MAPI。它可能会在Windows的后续版本中更改或不可用。]
[The use of Simple MAPI is discouraged. It may be altered or unavailable in subsequent versions of Windows.]
MAPI $ c的缺点$ c>依赖于已安装的
MAPI
客户端。幸运的是,几乎所有支持 mailto
的软件也应支持 MAPI
。例如,Outlook就是这样,Mozilla Thunderbird也是。
The drawback to MAPI
is that it relies on a MAPI
client being installed. Fortunately, almost any software that supports mailto
should support MAPI
as well; Outlook does, for instance, and so does Mozilla Thunderbird.
这篇关于发送带签名的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!