.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

I have problem for sending Email Through c#.net

Posted By: Vikramraj     Posted Date: May 08, 2010    Points:2   Category :C#
I have Written code for sending E-Mail as Follows

Using System.net.Mail;
MailMessage msg = new MailMessage();

msg.To = txtTo.Text;

msg.From = txtFrom.Text;

msg.Subject = txtSubject.Text;

msg.Body = txtContent.Value;

lblStatus.Text = "Sending...";

SmtpMail.SmtpServer = "smtp.yourISP.com";

SmtpMail.Send(msg);

lblStatus.Text = "Sent "

the problem is if send Email on same ISP then Email sent successfully otherwise Error is as follows
System.Net.Mail.SmtpException Transction Failed The Server Response was 5.7.1
Plz Solve this Error

Responses
Author: Nikhil Kumar             
Posted Date: May 08, 2010     Points: 5   

SmtpMail.SmtpServer = "smtp.gmail .com";

If this is not the solution then visit :
http://dotnetask.blog.co.in and search you would get the perfect solution.
Thanks


Be helpful and enjoy life because it comes only onces. Give all the happiness to yours and remember it doesn't comes by money ...
Author: Lalij Mer             
Posted Date: May 10, 2010     Points: 5   

This is happening because the spam filter at the recipient's end may have blocked the domain from which you are sending mails. Try using a different SMTP host if possible.

http://forums.asp.net/t/1209210.aspx

http://forums.asp.net/p/1283299/2652474.aspx#2652474

http://forums.asp.net/t/1151644.aspx

http://www.dotnetspider.com/forum/157002-Sending-Mail-using-SMTP-Server.aspx

Please Check my answer if you help....
Thank You...

Lalit.
Author: BangaruBabuPureti             
Posted Date: May 13, 2010     Points: 5   

MailMessage mailMsg = new MailMessage();
mailMsg.From = new MailAddress(FromAddress);
mailMsg.To.Add(new MailAddress(ToAddress));
mailMsg.Subject = Subject;
mailMsg.BodyEncoding = System.Text.Encoding.GetEncoding("utf-8");

System.Net.Mail.AlternateView plainView = System.Net.Mail.AlternateView.CreateAlternateViewFromString
(System.Text.RegularExpressions.Regex.Replace(BodyText, @"<(.|\n)*?>", string.Empty), null, "text/plain");
System.Net.Mail.AlternateView htmlView = System.Net.Mail.AlternateView.CreateAlternateViewFromString(BodyText, null, "text/html");
mailMsg.AlternateViews.Add(plainView);
mailMsg.AlternateViews.Add(htmlView);

// Smtp configuration
SmtpClient smtp = new SmtpClient();

smtp.Port = 25;
smtp.Host = "mail.saiastro.in";
smtp.UseDefaultCredentials = true;

smtp.Credentials = new System.Net.NetworkCredential("mail.domain.com", "password"); ;
smtp.EnableSsl = false;

smtp.Send(mailMsg);


BangaruBabu Pureti
http://bangarubabupureti.spaces.live.com/


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend