How to: Create an E-Mail Item
Applies to |
---|
The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office. Project type
Microsoft Office version
For more information, see Features Available by Application and Project Type. |
This example creates an e-mail message in Microsoft Office Outlook.
Example
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);
}