Program aracılığıyla e-posta öğesi oluşturma

Bu örnek, Microsoft Office Outlook'ta bir e-posta iletisi oluşturur.

Şunlar için geçerlidir: Bu konudaki bilgiler Outlook için VSTO Eklenti projeleri için geçerlidir. Daha fazla bilgi için bkz. Office uygulaması ve proje türüne göre kullanılabilen özellikler.

Örnek

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
    CreateMailItem();
}
       
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);
}