We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Incorrect getSenderAddressType()

The attached sample msg returns “SMTP” for getSenderAddressType() this value should be “EX” for the msg (Accessing these via the underlying mapi fields yields the same issue).

Version 20.5 (Java)

** Just realized i cannot upload the msg, but would be happy to provide it

@j_briere,

Please zip the file and working sample code reproducing the issue and share with us here if that is not exceeding 3 MB size. If it is beyond that then you need to upload them on any file server and share download link with us.

Sample attached getSenderAddressType.msg.zip (22.1 KB)

Thank you for taking a look

@j_briere,

A ticket with ID EMAILJAVA-34716 has been created to investigate and resolve the issue. We will share notification with you once issue will be addressed.

Thank you Mudassir, I would also like to point out that the same sample returns null for the getSenderEmailAddress() & getSentRepresentingEmailAddress() properties (I think this is related to the getSenderAddressType) becuase in this case the sender address is an X400 address (which i need to get).

As with getSenderAddressType() i attempted to access the data via the MapiPropertyCollection as well with no luck.

@j_briere,

Actually, MailMessage does not support address in EX format and only supports SMTP. If you need to get original MSG properties, you need to use MapiMessage.fromFile without double conversion.

public void test() throws Exception
{
    MapiMessage mapi = MapiMessage.fromFile("getSenderAddressType.msg");
    printSenderAddress(mapi);

    // !!! double conversion
    MailMessage eml = MailMessage.load("getSenderAddressType.msg", new MsgLoadOptions());
    MapiMessage mapiFromEml = MapiMessage.fromMailMessage(eml, new MapiConversionOptions());
    printSenderAddress(mapiFromEml);
}

private void printSenderAddress(MapiMessage mapi) {
    System.out.println("--------------------------------------");
    System.out.println(mapi.getSenderAddressType());
    System.out.println(mapi.getSenderEmailAddress());
    System.out.println(mapi.getSenderSmtpAddress());
    System.out.println(mapi.getSenderName());
}

Output:

EX /O=THE UNIVERSITY OF TEXAS-PAN AMERICAN/OU=BUSINESS AFFAIRS/CN=RECIPIENTS/CN=PAULA
null
Paula Berkley

SMTP
null
null
Paula Berkley

Thanks Mudassir, that was it.

@j_briere,

You are always welcome.