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

Free Support Forum - aspose.com

How to cancel sending emails synchronously?

I create sending emails synchronously.

SmtpClient client = new SmtpClient(…);

MailMessage msg = new MailMessage();



Can I cancel sending emails synchronously?



Thanks for considering Aspose.

Emails that are being sent synchronously, cannot be canceled. You need to send asynchronously using SmtpClient.SendAsync() method. If there are large number of emails, the best way is to use SmtpClientBulkSendAgent class.

Please see the attached demo that uses SmtpClientBulkAgent class to send multiple emails. It also shows the progress (Messages sent: 1 of n). If you stop the process, you can also get the recipients, to whom email could not be sent.


Thank you.