I'm creating mail sender web service. Every 10 second 1 mail sent. My total mail count 1500. this operation ends after 4.16 hours later (1500*10/60/60).
My web service method is here>>
[WebMethod]
public string BroadcastMail(DataView dv, string title, string body,MailAddress FromAddress, string[] fileattachments)
{
SmtpClient client = new SmtpClient("smtp.mysite.com");
client.EnableSsl = false;
client.UseDefaultCredentials = true;
client.Credentials = new NetworkCredential("*********", "********");
foreach (DataRowView item in dv)
{
MailMessage msg = new MailMessage();
msg.From = FromAddress;
msg.Subject = title;
msg.IsBodyHtml = true;
msg.BodyEncoding = Encoding.UTF8;
msg.Body = body.AsciiToUnicode();
msg.To.Add(email);
client.Send(msg);
Thread.Sleep(10000);
}
}
You want ask from me. Why you wait 10 second. Because my mail provider agreed that mail account every 1 hour possible to send 300 mail.
I want calling from aspx page.
My question is:
How to call this service from aspx page?
This web service work or not?
You have another idea?