Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
All-Star
18279 Points
2733 Posts
Feb 21, 2010 06:33 AM|LINK
Hi
Try after removing the following line of code:
mySmtpClient.Port = 587;
If it does n't work, try using the port 465.
Also, remove the settings in the web.config. Folllowing is the sample code that sends a simple email using Gmail smtp, it is in VB but you can surely have an idea:
Dim mm As New MailMessage() mm.To.Add("toAddress") mm.From = New MailAddress("FromAddress") mm.Subject = "Test Subject" mm.Body = "Message Details" Dim ss As New SmtpClient("smtp.gmail.com") ss.Credentials = New System.Net.NetworkCredential("username","password") ss.EnableSsl = True ss.Send(mm)
The above code will work, if you are not behind a proxy and directly connected to the internet.
asp .net 2. 0
adeelehsan
All-Star
18279 Points
2733 Posts
Re: i have a problem with password recovery control
Feb 21, 2010 06:33 AM|LINK
Hi
Try after removing the following line of code:
mySmtpClient.Port = 587;
If it does n't work, try using the port 465.
Also, remove the settings in the web.config. Folllowing is the sample code that sends a simple email using Gmail smtp, it is in VB but you can surely have an idea:
Dim mm As New MailMessage()
mm.To.Add("toAddress")
mm.From = New MailAddress("FromAddress")
mm.Subject = "Test Subject"
mm.Body = "Message Details"
Dim ss As New SmtpClient("smtp.gmail.com")
ss.Credentials = New System.Net.NetworkCredential("username","password")
ss.EnableSsl = True
ss.Send(mm)
The above code will work, if you are not behind a proxy and directly connected to the internet.
asp .net 2. 0
MCPD ASP.NET 4.0 and 3.5, MCTS WSS, MOSS, SharePoint 2010, MCT
Microsoft Community Contributor Award 2011