SmtpClient smtpclient; MailMessage message; string str234 = "Name=" + txtname.Text + "\n Address=" + txtaddress.Text
+ "" + "'\n Phone No=" + txtmobileno.Text + "\n Fax No=" + txtfax.Text
+ "\n Email=" + txtemail.Text + "\n Message=" + txtmessage.Text; smtpclient = new SmtpClient(); message = new MailMessage(); message.From = new MailAddress("developerlifestyle@gmail.com"); message.To.Add("developerlifestyle@gmail.com"); //send email to gmail message.Subject = "Contact Form"; message.Body = str234; smtpclient.Host = "smtp.gmail.com"; smtpclient.EnableSsl = true; smtpclient.UseDefaultCredentials = true; System.Net.NetworkCredential network = new System.Net.NetworkCredential(); network.UserName = "developerlifestyle@gmail.com"; network.Password = "*******"; //password smtpclient.UseDefaultCredentials = true; smtpclient.Credentials = network; smtpclient.Port = 25; smtpclient.Send(message);
02:36
|
Category:
|
0
comments
Comments ( 0 )