try { MailMessage mail = new MailMessage(txtfrom.Text, txtto.Text); mail.From = new MailAddress(txtfrom.Text); mail.To.Add(txtto.Text); mail.Subject = txtsubject.Text; mail.Body = txtmess.Text; SmtpClient smtp = new SmtpClient(); smtp.Host = "mail.mycompanyid.net"; smtp.Port = 25; NetworkCredential NetCrd = new NetworkCredential(); NetCrd.Domain = "ip"; NetCrd.UserName = "myid"; NetCrd.Password = "mypass"; smtp.UseDefaultCredentials = false; smtp.Credentials = NetCrd; smtp.EnableSsl = true; smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.Send(mail); MessageBox.Show("Your Message Sent Successfully"); } catch (Exception ee) { MessageBox.Show("Cannot send message: " + ee.Message); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)