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

Free Support Forum - aspose.com

How to send bulk emails using ssl enabled smtp?

Hai,
In my desk top application i am using aspose for sending bulk emails… and its is sending bulk emails using smtp server. but when i try to send bulk emails using ssl enabled smtp server(like gmail) its is not sending? i am using bulk agent for sending…,
I used this codes for enable ssl
client.SecurityMode = SmtpSslSecurityMode.Explicit;
client.EnableSsl = true;
its working when i send single email by using client.Send(message); method.
can u pleae help me for sending bulk emails using ssl enabled smtp server settings.
Regards,
sajeesh


Hi Sajeesh,

Please see the code sample that sends bulk emails using SmtpClient.BulkSend() method. I will check the bulk agent method shortly.

Aspose.Network.Mail.SmtpClient

client = new Aspose.Network.Mail.SmtpClient("smtp.gmail.com", 25, "user@gmail.com", "password");

// SSL settings

// set the port to 587. This is the SSL port of Gmail SMTP server

client.Port = 587;

// set the security mode to explicit

client.SecurityMode = SmtpSslSecurityMode.Explicit;

// enable SSL

client.EnableSsl = true;

//Create all your messages

MailMessage msg1 = new MailMessage("mail@gmail.com", "yourmail@yourdomain.com", "msg1", "hello, how are you?");

MailMessage msg2 = new MailMessage("mail@hotmail.com", "yourmail@yourdomain.com", "msg2", "hello, how are you?");

Aspose.Network.Mail.MailMessageCollection manyMsg = new MailMessageCollection();

manyMsg.Add(msg1);

manyMsg.Add(msg2);

//Use client.BulkSend function to complete the bulk send task

try

{

client.BulkSend(manyMsg);

MessageBox.Show("done");

}

catch (Exception ex)

{

System.Diagnostics.Trace.WriteLine(ex.Message);

MessageBox.Show(ex.Message);

}


Hi
I tried the above code. but an exception is coming while sending it states "At leat one E-mail message failed to deliver"
I had done this code:
MailMessage template = CreateMessage();


TemplateEngine engine = new TemplateEngine(template);
if (General.SelectedSignature > -1)
{
engine.RegisterRoutine(“GetSignature”, new Aspose.Network.Mail.TemplateRoutine(GetSignature));
}
InitializeDt();// filling the data table with values

MailMessageCollection messages = engine.Instantiate(dt); // where dt is data table.
//changed
SmtpClient client = new SmtpClient();
client.Host = smtp.gmail.com;
client.Username = sajeesh@gmail.com;
client.Password = *******;
client.Port = 587;
client.SecurityMode = SmtpSslSecurityMode.Explicit;
client.EnableSsl = true;
try
{
client.BulkSend(messages);
MessageBox.Show(“done”);

}

I filled the mail message collection by using a data table…

can you please send me the code for sending bulk emails using ssl enabled smtp server settings using bulk agent method.
Regards,
sajeesh,