Error-While sending Mail
-
Hi, I designed a windows applciation by reading mail id's from text file and sending mails. But after sending more than 900 mails i am getting this error. Exception Occured System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host Can any one help reg this error... I used the code as follows MailAddress SendFrom = new MailAddress(txtFromAddr.Text); SmtpClient objSmtpClient = new SmtpClient(); objSmtpClient.Host = "mail.domain.com"; objSmtpClient.Credentials = new System.Net.NetworkCredential("uname", "pwd"); while (!strdata.EndOfStream) { _mailId = Convert.ToString(strdata.ReadLine()); if (_mailId != "") { MailAddress SendTo = new MailAddress(_mailId); MailMessage objMailMessage = new MailMessage(SendFrom, SendTo); objMailMessage.Subject = Convert.ToString(txtSubject.Text); objMailMessage.Body = Convert.ToString(webBrowser1.DocumentText); objMailMessage.IsBodyHtml = true; objSmtpClient.Send(objMailMessage); } } G. Satish
-
Hi, I designed a windows applciation by reading mail id's from text file and sending mails. But after sending more than 900 mails i am getting this error. Exception Occured System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host Can any one help reg this error... I used the code as follows MailAddress SendFrom = new MailAddress(txtFromAddr.Text); SmtpClient objSmtpClient = new SmtpClient(); objSmtpClient.Host = "mail.domain.com"; objSmtpClient.Credentials = new System.Net.NetworkCredential("uname", "pwd"); while (!strdata.EndOfStream) { _mailId = Convert.ToString(strdata.ReadLine()); if (_mailId != "") { MailAddress SendTo = new MailAddress(_mailId); MailMessage objMailMessage = new MailMessage(SendFrom, SendTo); objMailMessage.Subject = Convert.ToString(txtSubject.Text); objMailMessage.Body = Convert.ToString(webBrowser1.DocumentText); objMailMessage.IsBodyHtml = true; objSmtpClient.Send(objMailMessage); } } G. Satish
Satish - Developer wrote:
after sending more than 900 mails
This may be your problem. I rather imagine your ISP wwill have terminated the SMTP connection after you sending so many emails. You should check with them about their bulk email policy.
"You're very clever, young man, very clever," said the old lady. "But it's turtles all the way down!"
-
Satish - Developer wrote:
after sending more than 900 mails
This may be your problem. I rather imagine your ISP wwill have terminated the SMTP connection after you sending so many emails. You should check with them about their bulk email policy.
"You're very clever, young man, very clever," said the old lady. "But it's turtles all the way down!"
Can u explain reg this... where i have to check for this...
-
Can u explain reg this... where i have to check for this...
You'll need to check with whoever runs the SMTP server that you are using to send your email. Many ISPs have rules about the number of emails you can send at a time to prevent spamming. I assume you have the permission of the people you are emailing?
"You're very clever, young man, very clever," said the old lady. "But it's turtles all the way down!"
-
You'll need to check with whoever runs the SMTP server that you are using to send your email. Many ISPs have rules about the number of emails you can send at a time to prevent spamming. I assume you have the permission of the people you are emailing?
"You're very clever, young man, very clever," said the old lady. "But it's turtles all the way down!"
When i run the Email application, automatically the to-address is repeating. ie. TO: satish.g@techgene.com; kiran@techgene.com; madhu@techgene.com; the above line is for one mail. And for next mail TO: satish.g@techgene.com; kiran@techgene.com; madhu@techgene.com; suchi@techgene.com like this for mail to mail.. the toaddress is repeating. But when i debug this, there is no loops to get this, and also when sending mail there is only one id in to-address? any idea ? what's the reason by coming like this? there is no loop to come like this. u can see the code in above posting
-
Hi, I designed a windows applciation by reading mail id's from text file and sending mails. But after sending more than 900 mails i am getting this error. Exception Occured System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host Can any one help reg this error... I used the code as follows MailAddress SendFrom = new MailAddress(txtFromAddr.Text); SmtpClient objSmtpClient = new SmtpClient(); objSmtpClient.Host = "mail.domain.com"; objSmtpClient.Credentials = new System.Net.NetworkCredential("uname", "pwd"); while (!strdata.EndOfStream) { _mailId = Convert.ToString(strdata.ReadLine()); if (_mailId != "") { MailAddress SendTo = new MailAddress(_mailId); MailMessage objMailMessage = new MailMessage(SendFrom, SendTo); objMailMessage.Subject = Convert.ToString(txtSubject.Text); objMailMessage.Body = Convert.ToString(webBrowser1.DocumentText); objMailMessage.IsBodyHtml = true; objSmtpClient.Send(objMailMessage); } } G. Satish
Satish - Developer wrote:
objMailMessage.Body =
Hi, in objMailMessage.To set only one ID. and all other ID set in objMailMessage.Cc Try it.
Thanks, Sun Rays Rate this post if you like answer. My Articles
-
Satish - Developer wrote:
objMailMessage.Body =
Hi, in objMailMessage.To set only one ID. and all other ID set in objMailMessage.Cc Try it.
Thanks, Sun Rays Rate this post if you like answer. My Articles
Hi, Please see the code below. I am reading mailid's from text file. In each line there is only one mailID. so "_mailid" contains only 1 id. now can u suggest how to put cc MailAddress SendFrom = new MailAddress(txtFromAddr.Text); SmtpClient objSmtpClient = new SmtpClient(); objSmtpClient.Host = "mail.domain.com"; objSmtpClient.Credentials = new System.Net.NetworkCredential("uname", "pwd"); while (!strdata.EndOfStream) { _mailId = Convert.ToString(strdata.ReadLine()); if (_mailId != "") { MailAddress SendTo = new MailAddress(_mailId); MailMessage objMailMessage = new MailMessage(SendFrom, SendTo); objMailMessage.Subject = Convert.ToString(txtSubject.Text); objMailMessage.Body = Convert.ToString(webBrowser1.DocumentText); objMailMessage.IsBodyHtml = true; objSmtpClient.Send(objMailMessage); } }
-
Hi, Please see the code below. I am reading mailid's from text file. In each line there is only one mailID. so "_mailid" contains only 1 id. now can u suggest how to put cc MailAddress SendFrom = new MailAddress(txtFromAddr.Text); SmtpClient objSmtpClient = new SmtpClient(); objSmtpClient.Host = "mail.domain.com"; objSmtpClient.Credentials = new System.Net.NetworkCredential("uname", "pwd"); while (!strdata.EndOfStream) { _mailId = Convert.ToString(strdata.ReadLine()); if (_mailId != "") { MailAddress SendTo = new MailAddress(_mailId); MailMessage objMailMessage = new MailMessage(SendFrom, SendTo); objMailMessage.Subject = Convert.ToString(txtSubject.Text); objMailMessage.Body = Convert.ToString(webBrowser1.DocumentText); objMailMessage.IsBodyHtml = true; objSmtpClient.Send(objMailMessage); } }
Hi,
Satish - Developer wrote:
MailAddress SendFrom = new MailAddress(txtFromAddr.Text);
without doing this. Just create mailmessage object.
MailMessage objMailMessage = new MailMessage(); objMailMessage.To = "toUser's email ID"; objMailMessage.Subject = Convert.ToString(txtSubject.Text); objMailMessage.Body = Convert.ToString(webBrowser1.DocumentText); objMailMessage.IsBodyHtml = true; SmtpClient objSmtpClient = new SmtpClient(); objSmtpClient.Host = "mail.domain.com"; objSmtpClient.Credentials = new System.Net.NetworkCredential("uname", "pwd"); objSmtpClient.Send(objMailMessage);
Just try this. If you are getting error then u must have to chekc for smtp setting of server.Thanks, Sun Rays Rate this post if you like answer. My Articles
-
Hi, I designed a windows applciation by reading mail id's from text file and sending mails. But after sending more than 900 mails i am getting this error. Exception Occured System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host Can any one help reg this error... I used the code as follows MailAddress SendFrom = new MailAddress(txtFromAddr.Text); SmtpClient objSmtpClient = new SmtpClient(); objSmtpClient.Host = "mail.domain.com"; objSmtpClient.Credentials = new System.Net.NetworkCredential("uname", "pwd"); while (!strdata.EndOfStream) { _mailId = Convert.ToString(strdata.ReadLine()); if (_mailId != "") { MailAddress SendTo = new MailAddress(_mailId); MailMessage objMailMessage = new MailMessage(SendFrom, SendTo); objMailMessage.Subject = Convert.ToString(txtSubject.Text); objMailMessage.Body = Convert.ToString(webBrowser1.DocumentText); objMailMessage.IsBodyHtml = true; objSmtpClient.Send(objMailMessage); } } G. Satish