Free Support Forum - aspose.com

Not setting sender name with on behalf of

I am trying to set sender email address and on behalf of address using the attached test application.
Aspose_Test_App_Onbehalf.zip (2.6 MB)

In the result PST mail sender and send on behalf of properties set properly(as i can see them in the outlook spy)
But in the view it is showing only the on behalf of id not showing the original sender name.
Please see the image attached.
Mail.PNG (62.5 KB)

Please help me on this.

@Shital_diwate,

Thank you for writing to Aspose support team.

You may please give a try to the following sample code and share the feedback.

MapiMessage mapi1 = new MapiMessage("from@domain.com", "to@domain.com", "Subject", "Body");
mapi1.SenderName = "Harry";
mapi1.SentRepresentingEmailAddress = "fromonbehalfof@domain.com";
mapi1.SentRepresentingName = "from_on_behalf_of";
//MSGFLAG_UNSENT
mapi1.SetMessageFlags(~MapiMessageFlags.MSGFLAG_UNSENT);
mapi1.Save(@"OnBehalfOf.msg");

I have tried to set the flag value that you provided still facing the same issue.
Please check attached test application.
Aspose_Test_App_Onbehalf.zip (2.6 MB)

There are two schenario.

  1. I am setting test@gmail.com as sender email address and TestSender as the display name. test1@gmail.com as the send on behalf of address and Test1 as send onbehalf of display name.
    In result PST email address is missing (only on behalf value is showing in the pst).
    Please refer attachment.
    image1.PNG (59.1 KB)
  2. I am setting both the sender email address and on behalf address as test@gmail.com and sender name and onbehalf name as Test( In such case where i don’t have separate send on behalf ). In this case From field is not showing. please refer attachment.
    Image2.PNG (58.4 KB)

In both the cases sender email name property is showing as Mapi_Not_Found in outlook spy.

Request your assistance on this.

@Shital_diwate,

I have tried following code using latest library Aspose.Email for .NET 18.3.0 and observed no issue as proper sender email address along with sender name property in MFCMapi is shown. You may please give a try to the following sample code using latest library and update your code in accordance of this sample code.

MapiMessage mapi1 = new MapiMessage("from@domain.com", "to@domain.com", "Subject", "Body");
mapi1.SenderName = "Harry";
mapi1.SentRepresentingEmailAddress = "fromonbehalfof@domain.com";
mapi1.SentRepresentingName = "from_on_behalf_of";
//MSGFLAG_UNSENT
mapi1.SetMessageFlags(~MapiMessageFlags.MSGFLAG_UNSENT);
string path = @"";
PersonalStorage pst = PersonalStorage.Create(path + "output.pst", FileFormatVersion.Unicode);
FolderInfo calendarFolder = pst.CreatePredefinedFolder("Inbox", StandardIpmFolder.Inbox);
calendarFolder.AddMapiMessageItem(mapi1);