Outlook Redemption won't let go the process when done |
| Diana Churchill posted at 04-Jul-08 10:39 |
Hi. I have to generate and send emails from C#.net 2.0 and have to use outlook. I am using Redemption to bypass the outlook security checks, but have the same problem when using CDO.
I create an RDO session for a mailbox, send the message on its behalf, and then have to change mailbox, and send different message on behalf of the second mailbox. Despite logging off the RDO session, and setting it to null, outlook remains open between the two sends, and the sender remains the same when I send the second email. How can I get outlook to let go of the first mailbox? outlook ceases to be a process on my pc only when the program is closed down, and not on logoff or setting to null.
RDOSession oSession = new RDOSession(); oSession.LogonExchangeMailbox("Electronic", string.Empty); if (oSession.LoggedOn) { RDOMail oMail = oSession.GetDefaultFolder(rdoDefaultFolders.olFold erOutbox).Items.Add("IPM.Note");
oMail.Subject = "Test"; oMail.Body = "Test"; oMail.To = "D<d@u.net>"; object newFile = "C:\\testattachment.txt"; oMail.Attachments.Add(newFile, Missing.Value, Missing.Value, Missing.Value); oMail.Send(); } oSession.Logoff(); oSession = null;
oSession = new RDOSession(); oSession.LogonExchangeMailbox("Electronic B", string.Empty); if (oSession.LoggedOn) { rdoDefaultFolders olFolderOutbox = rdoDefaultFolders.olFolderOutbox; RDOMail oMail = oSession.GetDefaultFolder(olFolderOutbox).Items.Ad d("IPM.Note");
oMail.Subject = "Test"; oMail.Body = "Test"; oMail.To = "D<d@u.net>"; object newFile = "C:\\testattachment.txt"; oMail.Attachments.Add(newFile, Missing.Value, Missing.Value, Missing.Value); oMail.Send(); } oSession.Logoff(); oSession = null;
What am I doing wrong? |
|