Slowness with MapiMessage APIs

We are using Aspose version 19.2 to create mail in msg format.

Using MapiMessage object to do this.
We are facing slowness in below APIs of this object.

  1. getHeaders()
    MapiMessage msg = MailTransformationHelpers.initializePSTMapiMessage();
    HeaderCollection headerCollection = msg.getHeaders();
    headerCollection.add(headerKey, headerValue);

    Looks like getHeaders() is taking time when already there are lot of headers present in the collection. Is there any other way to set the headers?

  2. setRecipients()
    We are constructing MapiRecipientCollection object and adding each recipient to the collection.

    MapiMessage msg = MailTransformationHelpers.initializePSTMapiMessage();

    MapiRecipientCollection rc = new MapiRecipientCollection();
    rc.add(smtpEmail, displayName, MapiRecipientType.MAPI_TO);
    rc.add(smtpEmail, displayName, MapiRecipientType.MAPI_CC);
    rc.add(smtpEmail, displayName, MapiRecipientType.MAPI_BCC);

    msg.setRecipients(rc);

Is there any known issues in these APIs?
Is there any other APIs to do the same task.

Note: we have large number of recipients across to/cc/bcc (around 15K)

@salimk,

First of all this is huge number of recipients in your email and it is going to consume time. Can you please try using latest Aspose.Email 20.6 on your end and in case you still feel the performance issue then share the following information:

1: JDK and Operating System Information
2: Source PST
3: Working sample code
4: Statistics of slow performance

Will try with latest version.

But another point is, we have a different version of our product where we use older Aspose version 16.11.0 and there we are not observing this slowness for same type of data. Was there any change in the above APIs ?

I have tried with 20.6 version. The performance is same, no improvement i could see.
While I am working on sample code can you provide little more details on the API.

You have mentioned 15K is huge number.
What is the ideal number library is capable of handling?
Is there any performance bench marking?

I have created ticket in paid support (6859)

@salimk

In that case please followup in paid support help desk for issue resolution and status,.

Mudassir,
I am yet to get a reply from other channel.

Will you be able to help with these questions:

What is the ideal number library is capable of handling?
Is there any performance bench marking?

@salimk,

Hopefully, you must have received the response by now in paid support help desk too.
Can you please elaborate your questions please as I am unable to understand this. If you are asking about how much bigger PST file library can handle. We have tested multiple GBs of PST file and API has performed well.

Question is specifically about below fields. Is there any benchmarking or expectations in these fields.

  1. Number of recipients.
  2. Number of headers.
  3. Number of characters in the header value.

@salimk,

There is no such known performance constraint on inquired things. If you feel some performance related issue, you can share the previously requested information so that we may verify the same.

Hi,
Using Aspose library we have noticed there are two different ways we can set headers.

1.String header = headerKey​ + ": " + headerVal​
MapiMessage ​.setStringPropertyValue(MapiPropertyTag.PR_TRANSPORT_MESSAGE_HEADERS_W, header);​​

2. HeaderCollection headerCollection = MapiMessage ​.getHeaders();
headerCollection.add(headerKey, headerValue);​​

What is the difference between these two methods? Which is the preferred way?​

Thanks,​
Salim

@salimk,

For MapiPropertyTag.PR_TRANSPORT_MESSAGE_HEADERS_W, the property contains transport-specific message envelope information for email.

Phot 1.png

The headerCollection.add(headerKey, headerValue) adds one line to property PR_TRANSPORT_MESSAGE_HEADERS_W.

The first approach set all headers where as the second only one header line.

1 Like

Thanks for the update.