Outlook.Application oApp = new Outlook.Application(); Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem); Outlook.Recipient oRecip = (Outlook.Recipient)oMsg.Recipients.Add("e-mail address"); oRecip.Resolve();
oMsg.Subject = ""; oMsg.Body = "";
String sSource = "C:\\test.txt"; String sDisplayName = "MyFirstAttachment"; int iPosition = (int)oMsg.Body.Length + 1; int iAttachType = (int)Outlook.OlAttachmentType.olByValue; Outlook.Attachment oAttach = oMsg.Attachments.Add(sSource, iAttachType, iPosition, sDisplayName); oMsg.Display(true);
|