How to receive result of sending the letter in MS Outlook?
-
Good afternoon. 1. In my program i send the letter through MS Outlook 2003. And so how to make so that it (Outlook) return in my program result of sending of the letter or I can not so I send:
// Create the Outlook application by using inline initialization. Outlook.Application = new Outlook.Application(); //Create the new message by using the simplest approach. Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem); //Add a recipient. Outlook.Recipient oRecip = (Outlook.Recipient)oMsg.Recipients.Add(CBTo.SelectedItem.ToString()); oRecip.Resolve(); //Set the basic properties. oMsg.Subject = "Letter"; oMsg.Body = ""; //Add an attachment. string sSource = currentPATH + @"\Attachment.zip"; 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); //Send the message. oMsg.Save(); oMsg.Send();
And so method Send simply sends the letter and if that show warning window Outlook, that the letter is not sent, and the program easy at this time works further... And it is necessary that it reacted to result! Method Send returns void. Can be other method? 2. How it is possible define a default box in MS Outlook through which letters by default send? Thanks.