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

Free Support Forum - aspose.com

SMTP Session

Hello

I am considering not only upgrading my Aspose.Words license to the latest version but to also get Aspose.Total. The reason for this is your presumably new product Aspose.Email.

Before buying and being disappointed I wanted to check first. Can the product control SMTP sessions?

We send lots of emails from our system and sometimes we run into trouble when users start an email process that grows very large due to either many hundreds of individual emails being contained in one session, or, a large attachment grows the session very large very quickly.

Can Aspose.Email split the sending of multiple emails into multiple SMTP sessions?

Regards

Rob

Hi Rob,

Thank you for writing to Aspose support team.

Aspose.Email provides rich features for handling large number of emails like sending bulk of emails using SmtpClient. Following is the sample code which sends bulk of emails in parallel using multiple SMTP sessions.

static SmtpClientBulkSendAgent agent;
static void TestBulkAgent()
{
MailMessage msg;
SmtpClient client = new SmtpClient(“smtp.gmail.com”, “user”, “password”);
client.SecurityOptions = SecurityOptions.SSLExplicit;
agent = new SmtpClientBulkSendAgent(client);
agent.BulkSendCompleted += new EventHandler(bulkAgent_BulkSendCompleted);
for (int i = 0; i < 500; i++)
{
msg = new MailMessage("user@gmail.com", "user2@gmail.com");
msg.Subject = “bulksend No.” + i;
msg.Body = “bulksend testing”;
agent.AddMessage(msg);
}
agent.Start();
}
static void bulkAgent_BulkSendCompleted(object sender, EventArgs e)
{
if (agent != null)
{
Console.WriteLine(“Bulk Email Summary”);
Console.WriteLine(“Number of emails processed: {0}”, agent.TotalProcessed);
Console.WriteLine(“Number of emails sent: {0}”, agent.TotalSent);
Console.WriteLine(“Number of emails with error: {0}”, agent.TotalFailed);
}
Console.WriteLine(“Press any key to continue…”);
}

Please feel free to write us back if you have any other query in this regard.

Thank you very much. This will solve my issues with too large SMTP sessions.

Regards

Rob