HOW TO:建立電子郵件項目

更新: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);
}

請參閱

概念

使用郵件項目

應用程式層級增益集程式設計入門