Add the default outlook signature in the email generated

There is a really quick easy way that hasn’t been mentioned. See modified below:

public static void GenerateEmail(string emailTo, string ccTo, string subject, string body)
{
    var objOutlook = new Application();
    var mailItem = (MailItem)(objOutlook.CreateItem(OlItemType.olMailItem));        
    mailItem.To = emailTo;          
    mailItem.CC = ccTo;
    mailItem.Subject = subject;
    mailItem.Display(mailItem);
    mailItem.HTMLBody = body + mailItem.HTMLBody;
}

By editing the HTMLBody after you display the mailitem you allow for Outlook to do the work of adding the default signature and then essentially copy, edit, and append.

Leave a Comment