5
Answers

having problemin sending email with asp.net2.0 C#

parimal patel

parimal patel

15y
5.7k
1
can anyone help for below code its not working .

 try
        {
            MailMessage mail = new MailMessage();
            mail.From = new MailAddress(txtemail.Text);
            mail.To.Add("username");
            mail.Subject = "Regarding Reservation";
            mail.SubjectEncoding = System.Text.Encoding.UTF8;
            mail.Body = txtfname.Text;
            mail.Body = txtlname.Text;
            mail.Body = txtAdd1.Text;
            mail.Body = txtAdd2.Text;
            mail.Body = txtcity.Text;
            mail.Body = txtstate.Text;
            mail.Body = txtzip.Text;
            mail.Body = txtph.Text;
            mail.Body = txtemail.Text;
            mail.Body = txtnoroom.Text;
            mail.Body = txtroomtype.Text;
            mail.Body = txtarr.Text;
            mail.Body = txtdep.Text;
            mail.Body = txtadult.Text;
            mail.Body = txtchild.Text;
            mail.Body = txtsmo.Text;
            mail.Body = txtcomment.Text;
            mail.IsBodyHtml = true;
            mail.Priority = MailPriority.Normal;
            SmtpClient client = new SmtpClient();
            client.Host = "smtp.yahoo.com";
            client.Port = 25;
            client.UseDefaultCredentials = true;
            client.Credentials = new System.Net.NetworkCredential("username","password");
            client.Send(mail);
        }
        catch(Exception ex)
        {
            ex.ToString();
        }
error:-- time out.
Thanks in advance
Answers (5)