View Single Post
  #8 (permalink)  
Old April 17th, 2010, 09:19 AM
banditonehundred banditonehundred is offline
Registered User
 
Join Date: Apr 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Argh...I must be doing something wrong...

Imar, I followed your link and added the following code to my website

Here's my code in Email.aspx

{public partial class Email : BasePage
{

protected void Page_Load(object sender, EventArgs e)
{
MailMessage myMessage = new MailMessage();
myMessage.Subject = "Test Message";
myMessage.Body = "Hello world, from PlanetWrox";

myMessage.From = new MailAddress("name@gmail.com", "My Name");
myMessage.To.Add(new MailAddress(""name@gmail.com", "My Name"));

SmtpClient mySmptClient = new SmtpClient();
mySmptClient.EnableSsl = true;
mySmptClient.Send(myMessage);
}
}
I added this code to web.config...

{
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="myname@gmail.com">
<network
port="587"
userName="myname@gmail.com"
password="mypassword"
host="smtp.gmail.com"/>
</smtp>
</mailSettings>
</system.net>
}

I still get the following error...

System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
Reply With Quote