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 asp.net 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 = "fromjai@gmail.com"; // put the from address here
mail.To = "tojai@domain.com"; // put to address here
mail.Subject = "Test"; // put subject here
mail.Body = "Testing 12345 "; // put body of email here
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", "2"); //port to launch send
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "reporting@domain.com"); //set your username here
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "yourpassword"); //set your password here
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "465"); //set your port here
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", "smtp.gmail.com"); //set your password here
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", true); //set SSL option to true

// send the mail
SmtpMail.Send(mail);


hope this help.

Shared Button