sending the mails from c#
Its a simple code for sending the mail from ur c# application
just add the namespacess
using System.Net;
using System.Web.Mail;
then
add the follwing ......
Button1
TextBox1 (set the name in the properties like... txtto)
TextBox2 ( set the name in the properties like.. txtsub)
Textbox3 ( set the name in the properties like .. txtmsgbody
and set the textmode as multiline)
Label1 ( set the name in the properties like .. lblmsg)
write the code
on button_click()
--------------
protected void Button1_Click(object sender, EventArgs e)
{
MailMessage mm = new MailMessage();
try
{
mm.From = "gopiyadavalli@yahoo.com"; // this is ur mail ID
mm.To =txtto .Text.ToString();
mm.Body = txtmsgbody.Text.ToString();
mm.Subject = txtsub.Text.ToString();
System.Web.Mail.SmtpMail.Send(mm);
lblmsg.Text = "Email successfully sent.";
}
catch (Exception ex)
{
lblmsg.Text = "Send Email Failed." + ex.Message;
}
}
gud its working
thanks for ur coding