Below is my code for sending mail and it shows an error
The server rejected the sender address. The server response was: 530 5.7.1 Authentication required
System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage();
mail.To = "hsbanga@yahoo.com";
mail.From = "hsbanga@yahoo.com";
mail.Subject = "Query from agnihotrindt";
mail.Body = "Name : " + TextBox1.Text + "<br/>" + "Email: " + TextBox2.Text + "<br/>Contact :" + TextBox3.Text + "<br/><br/><b>Address:</b><br/>" + TextBox4.Text + "<br/><b>Comment:</b><br/>" + TextBox5.Text ;
mail.BodyFormat = System.Web.Mail.MailFormat.Html;
mail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"] = 25;
mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 2;
mail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1;
mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = "hsbanga@yahoo.com";
mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = "secret";
mail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpusessl"] = "false";
System.Web.Mail.SmtpMail.SmtpServer = "smtp.mail.yahoo.com";
System.Web.Mail.SmtpMail.Send(mail);