Free Support Forum - aspose.com

SmtpClientBulkSendAgent and byte[]

Hi,

1/ How to set the maximum number of threads in the MessagePool ?

2/ There is a wording problem with the name of the method "TotolSent" (should be "TotalSent").

3/ I have a list of eml files (list of byte[]) that I would like to send using SmtpClientBulkSendAgent but it takes only MailMessage or MailMessageCollection.

I would like to know why method AddMessages could not take raw data of eml messages directly or at least what the best way (and most performant way) to convert all my byte[] to MailMessageCollection.

Thanks

Hi,


Thank you for writing to us.

1. At present, the API doesn’t support setting the number of threads. By default, it sets maximum number of threads to 5.

2. I’ve logged this issue as NETWORKNET-33703 in our issue tracking system and we’ll fix it in the upcoming version of Aspose.Email for .NET.

3. You can load the individual eml files from stream and then add these to MailMessageCollection using the Add method.

//byte[] buffer contains the eml data

Stream stream = new MemoryStream(buffer);

MailMessage eml = MailMessage.Load(stream);

MailMessageCollection manyMsgs = new MailMessageCollection();

manyMsgs.Add(eml);

Hi,

Thanks for your reply.

Can you add an option to set the maximum number of threads ?

Thanks

Hi Dominique,


Sorry for the miscommunication here.

You can use the second constructor of SmtpClientBulkSendAgent for this purpose that allows you to specify the concurrent threads. Please feel free to write back to us if you have any additional query/inquiry related to Aspose.Email. We’ll be glad to assist you further.

SmtpClientBulkSendAgent
agent = new SmtpClientBulkSendAgent(new SmtpClient, int concurrent);<o:p></o:p>