Email From contains "on behalf of" after sending mail from Outlook

Hi Aspose,

We love Aspose and have great succes with your product.
But we need help regarding a problem when Apose creates a new draft email, and the user opens the mails in Outlook and sends the mail. The problem is that the "From" always ends up with the "on behalf of" text (in the sent folder). I have tried all combinations of setting the property values (see below) without any luck.

We previously used "IndependeSoft.Msg" without this problem. But we decided to switch to Aspose, because you have a better product. Maybe except for the problem described.

The test program looks likes this:

MailMessage asposeMessage = new MailMessage();
asposeMessage.To.Add(new MailAddress("lars@nexcom.dk", "Lars Bondergaard", true));
asposeMessage.Subject = "My test mail";
asposeMessage.Body = "TEST";

MapiMessage mapiMessage = MapiMessage.FromMailMessage(asposeMessage);

mapiMessage.SetMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT | MapiMessageFlags.MSGFLAG_FROMME );

mapiMessage.SetStringPropertyValue(MapiPropertyTag.PR_SENDER_ADDRTYPE, string.Empty);
mapiMessage.SetStringPropertyValue(MapiPropertyTag.PR_SENDER_EMAIL_ADDRESS, string.Empty);
mapiMessage.SetStringPropertyValue(MapiPropertyTag.PR_SENDER_NAME, string.Empty);

mapiMessage.SetStringPropertyValue(MapiPropertyTag.PR_SENT_REPRESENTING_ADDRTYPE, string.Empty);
mapiMessage.SetStringPropertyValue(MapiPropertyTag.PR_SENT_REPRESENTING_EMAIL_ADDRESS, string.Empty);
mapiMessage.SetStringPropertyValue(MapiPropertyTag.PR_SENT_REPRESENTING_NAME, string.Empty);

mapiMessage.Save("c:\\testmail.msg");

Hope you can help me ASAP.

With regards
Lars Bondergaard
Nexcom A/S
lars@nexcom.dk

Hi Lars,


Thank you for using Aspose.Email for .NET.

I have tested this issue at my end using the latest version of Aspose.Email for .NET 4.0.0 and was able to observe the issue as you have specified. I have forwarded the details of this issue to our development team via ticket id: NETWORKNET-34324 for further investigation and resolution. Once there is an update available in this regard, we’ll update you here via this thread.

We regret the inconvenience caused to you.

The issues you have found earlier (filed as NETWORKNET-34324) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi Aspose,

I cannot see that this error has been fixed.

Attached you will find 3 emails:

1. Aspose generated unsend mail, sent from Outlook
2. Independsoft generated unsend mail, sent from Outlook
3. Outlook generated unsend mail, sent from Outlook

As you can see the Aspose generated mail from the Outlook "Sent items" still contains the "behalf of" in the from field. The Independentsoft and Outlook generated mails are ok.

Please help us with this error. It is very important for our product/business that this works.

With regards
Lars Bondergaard

Test case A
PR_SENDER_ADDRTYPE = ""
PR_SENDER_EMAIL_ADDRESS = etray@nexcom.dk
PR_SENDER_NAME = "eTray"
PR_SENT_REPRESENTING_ADDRTYPE = ""
PR_SENT_REPRESENTING_EMAIL_ADDRESS = etray@nexcom.dk
PR_SENT_REPRESENTING_NAME = "eTray"

Draft mail is ok, received mail is ok, mail in "Sent item" is not ok.

Test case B
PR_SENDER_ADDRTYPE = ""
PR_SENDER_EMAIL_ADDRESS = etray@nexcom.dk
PR_SENDER_NAME = "eTray"
PR_SENT_REPRESENTING_ADDRTYPE = ""
PR_SENT_REPRESENTING_EMAIL_ADDRESS = ""
PR_SENT_REPRESENTING_NAME = ""

Draft mail is not ok, received mail is ok, mail in "Sent item" is ok.

Test case C
PR_SENDER_ADDRTYPE = ""
PR_SENDER_EMAIL_ADDRESS = ""
PR_SENDER_NAME = ""
PR_SENT_REPRESENTING_ADDRTYPE = ""
PR_SENT_REPRESENTING_EMAIL_ADDRESS = ""
PR_SENT_REPRESENTING_NAME = ""

Draft mail is not ok, received mail is not ok, mail in "Sent item" is not ok.

Hi Lars,


We are sorry for a delayed response.

I have tested this scenario at my end using the latest version of Aspose.Email for .NET 4.1.0 and I am afraid to share that I could not reproduce the aforementioned problem at my end. I have attached the sent mail here for your reference. Could you please check if you have used the latest version of Aspose.Email in your application? We’ll look into it for your further assistance.

Sorry for the late response.

Please see attached Word document for information regarding Aspose.Email.dll version 4.1.0.0 which we are using. I also attached some code and screen dumps of the draft mail, the "Sent item" mail and the received mail.

Feel free to call me on +45 40546484 (Europe time :-)

Lars Bondergaard
Nexcom A/S

Hi Lars,


As I am unable to reproduce the issue at my end using the latest version of Aspose.Email for .NET, it seems that this may relate to some possible Outlook configuration. I have logged your comments against the logged ticket to obtain development team’s feedback in this regard and will update you here as soon as there is some information available.

Hi again,

Could you by any chance guide me in the correct use of the MAPI properties:

PR_SENDER_ADDRTYPE
PR_SENDER_EMAIL_ADDRESS
PR_SENDER_NAME
PR_SENDER_ENTRYID

PR_SENT_REPRESENTING_ADDRTYPE
PR_SENT_REPRESENTING_EMAIL_ADDRESS
PR_SENT_REPRESENTING_NAME
PR_SENT_REPRESENTING_ENTRYID

Regards to sending mails from Exchange account other then my own.
And of cource I have to be registred as "Owner" of this Exchange account.

I see that when I add en entryID, I get a different result regarding the "From" account
on the draft mail, the received mail and the mail in the "Sent Items" folder.
But none of my many many tries have succedded in getting the correct "From" account
in all of three mails.

With regards
Lars Bondergaard
Nexcom A/S

Hi Lars,

With respect to the sending email, if the properties are set as follow, the PR_SENT_REPRESENTING_ENTRYID is absent.

mapiMessage.SetStringPropertyValue(MapiPropertyTag.PR_SENDER_ADDRTYPE, string.Empty);
mapiMessage.SetStringPropertyValue(MapiPropertyTag.PR_SENDER_EMAIL_ADDRESS, "etray@nexcom.dk");
mapiMessage.SetStringPropertyValue(MapiPropertyTag.PR_SENDER_NAME, "eTray");

mapiMessage.SetStringPropertyValue(MapiPropertyTag.PR_SENT_REPRESENTING_ADDRTYPE, string.Empty);
mapiMessage.SetStringPropertyValue(MapiPropertyTag.PR_SENT_REPRESENTING_EMAIL_ADDRESS, "etray@nexcom.dk");
mapiMessage.SetStringPropertyValue(MapiPropertyTag.PR_SENT_REPRESENTING_NAME, "eTray");

As per our investigation, when sending a saved message, Outlook adds PR_SENT_REPRESENTING_ENTRYID property, and if it is different from the PR_SENDER_ENTRYID property, “on behalf of” will be displayed in the sent items.

If PR_SENT_REPRESENTING_EMAIL_ADDRESS property is set as follows:

mapiMessage.SentRepresentingEmailAddress = "etray@nexcom.dk";

instead of

mapiMessage.SetStringPropertyValue(MapiPropertyTag.PR_SENT_REPRESENTING_EMAIL_ADDRESS, "etray@nexcom.dk");

PR_SENT_REPRESENTING_ENTRYID property will also be set implicitly and the behavior should be as expected i.e. the “On Behalf of” should not be present in the sent email. Could you please give it a try at your end and let us know your feedback?

Hi Kashif,

Great, I got a solution now !!
See attach document for coding example.

Many thanks for your help. I appreciate it.

With regards
Lars Bondergard
Nexcom A/S

Hi Lars,


Thank you for sharing the feedback and its good to know that your issue is solved now. If you have any other query/inquiry related to Aspose.Email, please feel free to contact us for further assistance.