Here is the code I used to open out look and set the to address and tittle and to do a attachment to that mail.

application.Visible = true;

book.SaveCopyAs(@”” + ConfigurationSettings.AppSettings[“Reports”] + “Course Schedules for “ + lblProviderName.Text + “.xls”);

Outlook.Application outlookApp = new Outlook.Application();

Outlook.MailItem message = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);

message.Subject = “Course Schedules for “ + lblProviderName.Text + ” (“ + this.providerNumber + “) “;

message.Recipients.Add(“someone@email.com”);

message.Body = “”;

int attachmentLocation = 1;

message.Attachments.Add(“” + ConfigurationSettings.AppSettings[“Atachments”] + “Course Schedules for “ + lblProviderName.Text + “.xls”, Outlook.OlAttachmentType.olByValue,

attachmentLocation, “Course Schedules for “ + lblProviderName.Text + “.xls”);

message.Display(false);

Advertisements