1

我需要创建一封电子邮件,但是当按钮被触发时,我希望它使用预先格式化的电子邮件打开 Outlook。

由于客户端有一些限制,我不希望它从程序本身发送电子邮件,我希望它在 Outlook 中打开。

像这样的东西:

Dim email As New CDO.Message
With email
    .From = "the_sender@company1.com"
    .To = "the_reciever@company2.com"
    .Subject = "Great e-mail"
    .HTMLBody = "<h1>Header for a cool email</h1> And cool HTML"
    .AddAttachment("Cute_kitty.jpg")

    '.Send() NO! Open outlook with this stuff typed above and make sender useless
End With

我怎样才能做到这一点?我找到了这些东西,但它(当然)不支持 html 电子邮件和附件......

Dim proc As System.Diagnostics.Process = New System.Diagnostics.Process
proc.StartInfo.FileName = "mailto:the_reciever@company2.com?subject=Great e-mail&body=My cool email that does not support html n stuff"
proc.Start()

建议?

4

1 回答 1

1

如果要在 Outlook 中打开邮件,则需要使用 Outlook 对象模型。类似的东西:

set App = CreateObject("Outlook.Application")
set NS = App.GetNamespace("MAPI")
NS.Logon
set email = App.CreateItem(0)
With email
.To = "the_reciever@company2.com" .Subject
= "很棒的电子邮件"
.HTMLBody = 您的 HTML 文本"
.Attachments.Add("c:\temp\Cute_kitty.jpg")
.Display
End With

于 2013-01-14T16:53:14.520 回答