Wednesday, October 28, 2009

The server rejected the sender address. The server response was: 530 5.7.0 Must issue a STARTTLS command first

Cause: When you are going to send mail in 1.1 by using google smtp server.then generally following error come.

Error:"The server rejected the sender address. The server response was: 530
5.7.0 Must issue a STARTTLS command first. f42sm2050000rvb.9"

Solution: Basically problem is SSL and Port. you need to set smtpusessl true and smtpserverport is 465.

C# Code:

MailMessage mail = new MailMessage();
mail.From = ""; // put the from address here
mail.To = ""; // put to address here
mail.Subject = "Test"; // put subject here
mail.Body = "Testing 12345 "; // put body of email here
mail.Fields.Add("", "1"); //basic authentication
mail.Fields.Add("", "2"); //port to launch send
mail.Fields.Add("", ""); //set your username here
mail.Fields.Add("", "yourpassword"); //set your password here
mail.Fields.Add("", "465"); //set your port here
mail.Fields.Add("", ""); //set your password here
mail.Fields.Add("", true); //set SSL option to true

// send the mail

hope this help.


suresh said...

Thanks, The Above Code helped me a lot for when i am using System.web.Mail name space So i need Now For System.NET>Mail

Giridharan said...


Anonymous said...

Awesome work.. Thanks

Anonymous said...

You have made some really good points there. I looked on the web for additional information about the issue and found
most people will go along with your views on this web site.

Here is my webpage Breast Actives Actually

Anonymous said...

Thanks a lot......
This code really works!!!!!!

Mariappan Ganapthy said...

I using own mail server but while runing the code in same file it doesnt shows error added the below mentioned in different class file
private void MailSend_prop(string msg, string toAddress, string psubject)
System.Web.Mail.MailMessage msg1 = new System.Web.Mail.MailMessage();

msg1.From = ConfigurationManager.AppSettings["MailFromAdd"].ToString();
msg1.To = toAddress;
msg1.Subject = psubject;
msg1.Priority = System.Web.Mail.MailPriority.High;
msg1.BodyFormat = System.Web.Mail.MailFormat.Html;
string bodystring = string.Empty;
bodystring += msg;

msg1.Body = bodystring;

msg1.Fields.Add("", "1");
msg1.Fields.Add("", "2");
msg1.Fields.Add("", ConfigurationManager.AppSettings["MailServer"].ToString());
msg1.Fields.Add("", "25");
msg1.Fields.Add("", msg1.From);
msg1.Fields.Add("", ConfigurationManager.AppSettings["MailFromAddPwd"].ToString());

System.Web.Mail.SmtpMail.SmtpServer = ConfigurationManager.AppSettings["MailServer"].ToString();


catch (Exception ex)
throw ex;


Shared Button