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

Free Support Forum - aspose.com

Java 22.3 Email APIs not fetching read/delivery receipt info

Aspose Team,

Using the Aspose Java Email APIs version 22.3, we’re trying to extract some additional email properties for read and delivery receipts and the “getReplyTo” list of email recipients. We’ve included a simple email test file where we’ve requested a read and delivery receipt in Outlook/O365 and attempted to use the Aspose APIs to extract this information but thus far seeing only empty results. The API documentation seems to focus primarily on sending emails instead of fetching receipt info so we’re not entirely sure this is implemented correctly but we thought that we should at least see the “getReadReceiptRequested” API actually return true.

Here’s a code snippet that shows the gist of what we’d like to fetch. Can you please provide some help with regards to the use of these APIs and the behavior that we’re seeing?

    String paths = "Aspose Email Receipt test Java version 22.3.msg";
    MapiConversionOptions mco = MapiConversionOptions.getUnicodeFormat();
    mco.setPreserveEmptyDates(true);
    MailMessage mailMessage = MailMessage.load(paths, getAsposeEmailLoadOptions(false));
    MapiMessage mapiMessage = MapiMessage.fromMailMessage(mailMessage, mco);

    int notificationOptions = mailMessage.getDeliveryNotificationOptions();
    boolean testDeliveryReceiptRequested = (notificationOptions == DeliveryNotificationOptions.OnSuccess || notificationOptions == DeliveryNotificationOptions.OnFailure);
    boolean testReadReceiptRequested = mapiMessage.getReadReceiptRequested();
    String testReplyTo = mapiMessage.getReplyTo();
    Logger.Debug("Email properties: Delivery receipt requested=" + testDeliveryReceiptRequested + ", read receipt requested=" + testReadReceiptRequested + ", reply to=" + testReplyTo);

Here are the results of our logging output statement:

"Email properties: Delivery receipt requested=false, read receipt requested=false, reply to="

Aspose Email Receipt test Java version 22.3.msg.zip (14.0 KB)

Thank you for your help.
Jerry

@jmuth

We have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as EMAILJAVA-35043. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Thanks for the update, Tahir. We’ll look forward to hearing about a resolution.

@jmuth

Please Load Mapi message without any conversion and print PR_READ_RECEIPT_REQUESTED property:

MapiMessage mapiMessage = MapiMessage.load("Aspose Email Receipt test Java version 22.3.msg");
System.out.println("read receipt requested=" + mapiMessage.getReadReceiptRequested());
Output:
read receipt requested=true

The ReadReceiptTo EML property used during conversion from Outlook MSG.
If MSG property PR_READ_RECEIPT_REQUESTED=true, EML property ReadReceiptTo will be assigned from sender SMTP address.

// Next line converts source MAPI MSG to EML.
// MSG PR_READ_RECEIPT_REQUESTED mapi property is true. 
// During conversion ReadReceiptTo EML property will be assigned from Sender SMTP Address mapi property (PR_SENDER_SMTP_ADDRESS).
// Source MSG file does not contains Sender SMTP Address and ReadReceiptTo cannot be assigned.
MailMessage mailMessage = MailMessage.load(paths, getAsposeEmailLoadOptions(false));
// Next line converts EML to MAPI. The ReadReceiptTo EML property was not assigned in the first line. So, ReadReceiptRequested flag will be lost during reverse conversion.
MapiMessage mapiMessage = MapiMessage.fromMailMessage(mailMessage, mco);

Thanks, Tahir. We’ll take a look at this.

Tahir,

We’re now seeing results for the read receipt and ReplyTo fields using the change suggested above. Is there any way to get the Delivery Receipt requested value as well?

Thanks, Jerry

@jmuth

We have logged your requirement in the same issue EMAILJAVA-35043. We will inform you once there is an update available on it.

@jmuth

Following code sample is used to read Delivery Receipt requested value. Hope this helps you.

MapiMessage mapiMessage = MapiMessage.load(paths);
System.out.println("read receipt requested=" + mapiMessage.getReadReceiptRequested());
// https://docs.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtagoriginatordeliveryreportrequested-canonical-property
System.out.println("delivery receipt requested=" +
        mapiMessage.getPropertyBoolean(MapiPropertyTag.PR_ORIGINATOR_DELIVERY_REPORT_REQUESTED));

MapiRecipient rcp = mapiMessage.getRecipients().get_Item(0);
System.out.println("track status=" +
        rcp.getPropertyLong(MapiPropertyTag.PR_RECIPIENT_TRACKSTATUS));

System.out.println("track recipient=" + rcp.getDisplayName());
System.out.println("track delivery time=" +
        rcp.getPropertyDateTime(MapiPropertyTag.PR_RECIPIENT_TRACKSTATUS_TIME_DELIVERY));
System.out.println("track read time=" +
        rcp.getPropertyDateTime(MapiPropertyTag.PR_RECIPIENT_TRACKSTATUS_TIME_READ));

Thanks, Tahir. We’ll give this a try today and see if it provides what we need.

@jmuth

Please feel free to ask if you have any question about Aspose.Email, we will be happy to help you.

This seems to be giving us the correct value for the Delivery receipt now, Tahir. Thank you for your help! We appreciate the timely responses.

Jerry