I created a new email-message using Redemption-Data-Objects in C#. After calling Display(), the window is opened - all looks great.
When I try to send the message, by clicking the "send"-button, I get one of the following messages (translated from german...): "The messaging-interface returned an unknown error. try to restart outlook if the problem...." or "The element cannot be sent!"
When I use the Send-Method, all works fine, the email will be sent.
I tried OutlookSpy to find a solution - when i try to send the message i get return code 0x80020009.
Here is the sample-code:
Redemption.RDOSession session = new Redemption.RDOSession();
session.Logon(null, null, false, null, null, null);
Redemption.RDOFolder folder = session.GetDefaultFolder(Redemption.rdoDefaultFolders.olFolderOutbox);
Redemption.RDOMail newMail = folder.Items.Add(Redemption.rdoItemType.olMailItem);
// no difference when using .Add
newMail.Recipients.AddEx("[email protected]","[email protected]", "SMTP", Redemption.rdoMailRecipientType.olTo);
newMail.Recipients.ResolveAll();
newMail.Subject = "Testmail-Subject";
newMail.HTMLBody = "Test";
newMail.Display(false, Type.Missing);
Does anybody know a solution for that problem?
regards Martin
PS: I am using office 2010 (german) an Visual Studio 2010 (english) with target framework 2.0 in my project) on Windows 7 (english).
OK...
I found the "error".
Because my session ran out of scope, the context was lost and so the error occurred.
Here is the solution: