hello everyone
this is my window application code to send email
this my code
sending email failed help plz
am using c#2010
try
{
SmtpClient client=new SmtpClient("smptp.gmail.com",465);
MailMessage message = new MailMessage();
message.From = new MailAddress(txtemail.Text);
message.To.Add(txtreciever.Text);
message.Body = txtbody.Text;
message.Subject = txtsubject.Text;
client.UseDefaultCredentials = false;
client.EnableSsl = true;
if (txtattachment.Text != "")
{
message.Attachments.Add(new Attachment(txtattachment.Text));
}
client.Credentials = new System.Net.NetworkCredential(txtemail.Text, txtpassword.Text);
client.Send(message);
message = null;
MessageBox.Show("Message Sent");
}
catch(Exception ex)
{
MessageBox.Show( "Failed to Send Message");
}
Rajeesh MenothPosted Jun 2, 2015, 6:40 AM
Rajeesh MenothPosted Jun 2, 2015, 7:11 AM
soran mohamadPosted Jun 2, 2015, 7:10 AM
Gowtham KPosted Jun 2, 2015, 6:42 AM