how do i solve this error:“smtpException was unhandled by user code”
        Posted  
        
            by wide
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by wide
        
        
        
        Published on 2010-04-06T21:14:18Z
        Indexed on 
            2010/04/06
            21:23 UTC
        
        
        Read the original article
        Hit count: 691
        
ASP.NET
here is the code.
void sendMail()
{
    MailMessage mail = new MailMessage();
    mail.To.Add("[email protected]");
    mail.From = new MailAddress("[email protected]", txt_name.Text);
    mail.Subject = txt_subject.Text;
    mail.Body = txt_body.Text;
    SmtpClient smtp = new SmtpClient("smtp.gmail.com");
    smtp.EnableSsl = true;
    NetworkCredential yetki = new NetworkCredential("[email protected]", "11111111");
    smtp.Credentials = yetki;
    smtp.Send(mail);
    Response.Write("mailiniz basarili bir sekilde gönderilmistir");
}
protected void btn_gonder_Click(object sender, EventArgs e)
{
    sendMail();
}
© Stack Overflow or respective owner