i want to send an email using asp.net in c# below is the code:
the error that i get in the browser:"The transport failed to connect to the server."
when i change the port to 25 from vs2005 under the properties, it couldent even display the page
please advise, thanks in advance.
the error that i get in the browser:"The transport failed to connect to the server."
Code:
MailMessage mail = new MailMessage(); mail.To = toTxt.Text; mail.From = fromTxt.Text; mail.Subject = subjectTxt.Text; mail.Body = bodyTxt.Text; try { SmtpMail.SmtpServer = "smtp.gmail.com"; //i even put localhost but doesnt work SmtpMail.Send(mail); } catch (System.Web.HttpException ex) { Response.Write(ex.Message); }
please advise, thanks in advance.
Comment