Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

this is my code:

 

			System.Web.Mail.MailMessage message2 = new System.Web.Mail.MailMessage();

			message2.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1);
			message2.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "my [email]email@gmail.com[/email]");
			message2.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "my password");
			message2.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "587");

			message2.From = "myemail@gmail.com";
			message2.To = "someone@someplace.com";
			message2.Subject = "Message Subject";
			message2.Body = "Message Body";
			message2.BodyFormat = System.Web.Mail.MailFormat.Html;

			System.Web.Mail.SmtpMail.SmtpServer = "smtp.gmail.com";
			System.Web.Mail.SmtpMail.Send(message2);

 

When I try to send mail I get this error:

 

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

 

How could I enable TLS when I send the mail?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...