How to Send Bulk Emails?

Thanks. Yes I found out that I had to put NUnit in the project from GitHub and include using NUnit.Framework; in the top of the source to use the Asserts in the code.

My problem is in the smtpClient.SucceededSending event block. What code do I need to use to get the email addresses that Failed & the Reason for failure, and also the ones that Succeeded?

Also, what can I use to test a “Failed” email address scenario?

Also, I have Aspose.Email v21.5.0, should I update to the latest v21.6.0 ?

@GlennIM,
We will answer you as soon as possible.

@GlennIM

Can you please provide the working sample project reproducing the issue on your end so that we may proceed further to help you out.

I’m using the same code as the above. What code do I need to get the email addresses in the array that Failed & the Reason for failure, and also the ones that Succeeded ?

@GlennIM

We need to further investigate this on our end and a ticket with ID EMAILNET-40300 has been created to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

I fiddled around with my code and think I got it working. but I’m trying to add the email address that is sent successfully to a Listbox in C#. But there is a threading issue and the code below, when I put a breakpoint at the Invoke() method, can’t step into it and the the Event Handler just exits. How do I make the Listbox threadsafe so I can add the email address text to it?

client = new SmtpClient("mail.XXX.com", 587, "sales@XXX.com", "password", Aspose.Email.Clients.SecurityOptions.SSLExplicit);

using (client)
{
   client.SucceededSending += delegate (object senderX, MailMessageEventArgs evntArgs)
   {
       Assert.IsNotNull(evntArgs);
       Assert.IsNotNull(evntArgs.Message);
       Assert.IsTrue(evntArgs.Message.Subject.StartsWith(subjectPrefix));
       string toAddress = evntArgs.Message.To[0].Address;

       if (succeededToSendLB.InvokeRequired)
       {
           succeededToSendLB.Invoke(
              new MethodInvoker(
                 () => { succeededToSendLB.Items.Add(toAddress); }));
       }
       else
       {
           succeededToSendLB.Items.Add(toAddress);
       }
   };
}

@GlennIM

I think its beyond scope of API but I have added the information in our issue tracking system to see if we are able to help you with this.

Never mind. I figured it out.

I have another problem sending bulk emails and tried to send 387 emails out but I get this exception when manyMsg reaches 305.

I am getting an exception…

MailMessageCollection manyMsg
manyMsg Count = 305

try
{
smtpClient.Send(manyMsg);
Thread.Sleep(3000);
}
catch (Aspose.Email.AsposeException ae)
{
Aspose.Email.Clients.Smtp.SmtpFailedRecipientException ie = (Aspose.Email.Clients.Smtp.SmtpFailedRecipientException)ae.InnerException;
}

ae.Message = “The operation ‘Send’ terminated. Timeout ‘98656’ has been reached.”

What does this mean?

@GlennIM

Please share the workable scenario with sample example reproducing the issue. Can you please also ensure if there is any quota limit incurred on total number of emails in a specified time by your service provider?

The issues you have found earlier (filed as EMAILNET-40300) have been fixed in this update.