如何:创建电子邮件项

更新:2007 年 11 月

适用对象

本主题中的信息仅适用于指定的 Visual Studio Tools for Office 项目和 Microsoft Office 版本。

项目类型

  • 应用程序级项目

Microsoft Office 版本

  • Outlook 2003

  • Outlook 2007

有关更多信息,请参见按应用程序和项目类型提供的功能

此示例在 Microsoft Office Outlook 中创建电子邮件。

示例

Private Sub CreateMailItem()
    Dim mailItem As Outlook.MailItem = _
        Me.Application.CreateItem(Outlook.OlItemType.olMailItem)
    mailItem.Subject = "This is the subject"
    mailItem.To = "someone@example.com"
    mailItem.Body = "This is the message."
    mailItem.Importance = Outlook.OlImportance.olImportanceLow
    mailItem.Display(False)
End Sub
private void CreateMailItem()
{
    Outlook.MailItem mailItem = (Outlook.MailItem)
        this.Application.CreateItem(Outlook.OlItemType.olMailItem);
    mailItem.Subject = "This is the subject";
    mailItem.To = "someone@example.com";
    mailItem.Body = "This is the message.";
    mailItem.Importance = Outlook.OlImportance.olImportanceLow;
    mailItem.Display(false);
}

请参见

概念

使用邮件项

应用程序级外接程序编程入门