Known Sideeffects with Draft EMails when Outlook Cache is activated?

Hi, out web application generates a Mail Draft with the following coding:

MailMessage eml = new MailMessage();
AddAttachments(eml); //generates pdf-streams, append each stream as Attachment
MapiMessage msg = MapiMessage.FromMailMessage(eml);
msg.SetMessageFlags(MapiMessageFlags.MSGFLAGS_USENT);

MemoryStream stream = new MemoryStream();
msg.Save(stream);
context.Response.BinaryWrite(stream.GetBuffer());
stream.close();

Since years our Outlook-Clients run without activated Outlook-Cache and everthing was OK.
After the Outlook cache of some clients was activated last week, none of those clients can send the genereated Mail Drafts. A Security Error is thrown “You can not send a Mail in teh name of another User”. How can I prevent these Errors?

Thanks, Greetings from Germany
Rasputin

Hi Rasputin,


Thank you for your inquiry.

I manage to observe the said error message (error.png) but with “Cached Exchange Mode” option turned OFF. I can reproduce it again by setting the From field of MailMessage instance to some email address that is not an account of Outlook. In case the Cached Exchange Mode is ON, Exchange will send a delivery report to inbox with similar text.

I also tested the scenario by setting the From field with valid email address (an Outlook account) and by not setting at all. In your presented source sample, you are not setting the From field. In these cases the message was stuck in Outlook forever. I have logged an investigative ticket (NETWORKNET-33181) in this reference.

Please find the attachment for my sample application with latest assembly of Aspose.Email for .NET. In case I have missed any thing please let me know.

Regards

Hi Babar,

in our Environment we have the same Message and Cache Settings like those, shown in your attached Screen-Shot in your reply.

Does "investigative ticket" mean, that you check, weather the problem could be a wrong behaviour of the the classes in the aspose.dll when generating the msg-Stream?

Hi Rasputin,


Thank you for your response.

You are right, the ticket is to investigate the cause for messages not being sent to their recipients. If this unwanted behaviour is due to some problem in our component then we will surely provide you a fix for it.

Regards,

Hi Babar,

we keep on trying here, wether there is a possibility to change the wrong behaviour by Exchange setting(s).

We found out, that our generated mails can be sent, when the User chooses the adress from the adressbook. "From" and "replayTo" must be filled by selecting from the adressbook (not by entering!). When an adress ist selected, the Mail is automatically authorized by Outlook. Otherwise not! We now try here the following, which I found in a german article:

Get-ReceiveConnector "Anonymous Relay" | Add-ADPermission -User "NT AUTHORITY\Authenticated Users" -ExtendedRights "Ms-Exch-SMTP-Accept-Any-Recipient" (https://www.mcseboard.de/ms-exchange-forum-80/exchange-2007-send-as-permission-funktioniert-130040.html)

So far we have no chance to get an entry authorized, which is entered manually.

Kind regards

Rasputin

Hi Rasputin,


We are sorry to hear about your trouble.

To replicate your exact scenario, can you please share more details like version of Exchange Server, Outlook, Aspose.Email for .NET component and any Service Packs.

Please note, this is the default behaviour of Outlook that you have to select the From field from a list and you cannot type an entry. If From field is properly set then message will be sent fine else Outlook will pop-up the said error message.

I have noticed that a draft message generated by the latest assemblies automatically sets the Form field to AD user (Outlook account). Can you please verify this on your end by using the sample project shared earlier? Also please confirm if you are able to send the same message.

Looking forward to your response.

Hi Babar,

Our Environment:
- Outlook 2003 SP3
- Exchange 2007
- Aspose.Network.dll for 3.5 (4.9.0.0) without any SP

We know now :-) about the default behaviour of Outlook.
With the inactive Cache before, Selections from the list weren't necessary.
So we diddn't know that there was a latent problem.

I will check, whether the latest assemblies automatically set the from field to AD.
If Mails than can be sent whitout this "Authorization-Step" against the Adressbook
everything will be OK! Our Users enter external Adresses or take them from the autocompletion-List.
They use the Adressbook too, but seldom.

I'l keep you informed.

Regards
Rasputin

Hi Babar,

I tried to change my Coding from Aspose.Network.Mail to Aspose.Email.Mail to check, if the Problem is solved with the latest assemblies.

How can the Draft-Mode be set, like I could do with Aspose.Network.Mail ? //msg2.SetMessageFlags(Aspose.Network.Outlook.MapiMessageFlags.MSGFLAG_UNSENT

Thanks, Regards

Rasputin

Aspose.Email.Mail.MailMessage msg = MailMessage.Load("Draft.msg", MessageFormat.Msg);
msg.TextBody = msg.Subject = "mySubject " + DateTime.Now.ToShortDateString();

foreach (MyAttachment myAtt in MyAttachments) {
MemoryStream aStream = GetStreamFrom(myAtt); //generates Type "application/pdf"
Aspose.Email.Mail.Attachment att = new Attachment(aStream, myAtt.fileName, myAtt.fileType);
msg.AddAttachment(att);
}
msg.Save(emailStream, Aspose.Email.Mail.MailMessageSaveType.OutlookMessageFormat);
context.Response.BinaryWrite(emailStream.GetBuffer());
emailStream.Close();

Hi Rasputin,


Please check the below code to create a message in Draft Mode,

C#
MailMessage eml = new Aspose.Email.Mail.MailMessage();
eml.Subject = “test”;
MapiMessage msg = Aspose.Email.Outlook.MapiMessage.FromMailMessage(eml);
msg.SetMessageFlags(Aspose.Email.Outlook.MapiMessageFlags.MSGFLAG_UNSENT);

Hope this helps. Please feel free to write back.