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("
[email protected]", "My Name");
myMessage.To.Add(new MailAddress(""
[email protected]", "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="
[email protected]">
<network
port="587"
userName="
[email protected]"
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.