Hi
My code is as follows
foreach (DataRow row in dt.Rows){
MailMessage depotmsg = new MailMessage();
string FromMail = GetValueFromINI("FromEmail");
depotmsg.From = new MailAddress(FromMail, "myname");
depotmsg.Subject = "Expiry date reminder";
depotmsg.To.Add(new MailAddress(_email, _depotname));
depotmsg.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential(username, PassWord);
string port = GetValueFromINI("Port");
client.Port = Convert.ToInt32(port); // You can use Port 25 if 587 is blocked (mine is!)
string host = GetValueFromINI("Host");
client.Host = host;
client.EnableSsl = false;
string htmlString = getHtml(newDS);
depotmsg.Body = htmlString;
try
{
client.DeliveryMethod = SmtpDeliveryMethod.Network;
// client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
// client.PickupDirectoryLocation = @"E:\temp\email";
client.Send(depotmsg);
}
catch (Exception ex)
{
Console.WriteLine("Not Send ");
}
}
While running the program , the error message " The server response was: 4.4.2 Message submission rate for this client has exceeded the configured limit ."
But while debugging the program all the email will go without error message. I used the following method
client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
client.PickupDirectoryLocation = @"E:\temp\email";
But after that, no error is coming but the mail not sending from E:\temp\email .
Why all mail going fine while debugging but error message is coming while running exe . What is the solution for that.
Is it good solution to give the code to wait for a few second after sending each mail please anybody can advise me.
Please help with a solution, it would be very appreciate.
Regards
polachan