using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Mail;
using System.Net;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
}
public void sendmail(string from, string to, string subject, string body)
{
MailMessage mail = new MailMessage();
mail.From = from;
mail.To = to;
mail.Subject = subject;
mail.Body = body;
mail.Priority = MailPriority.High;
mail.BodyFormat = MailFormat.Text;
SmtpMail.SmtpServer = "192.168.5,11";
SmtpMail.Send(mail);
}
}
arjunPosted Dec 19, 2012, 7:28 AM
create a button and use this code...i think it will usefull to u
protected void
Button3_Click(object sender, EventArgs e)
{
String to = "[email protected]";
SmtpClient SmtpServer = new
SmtpClient();
String message="your message in body";
SmtpServer.Credentials = new System.Net.NetworkCredential("[email protected]
", "password");
SmtpServer.Port = 587;
SmtpServer.Host = "smtp.gmail.com";
SmtpServer.EnableSsl = true;
MailMessage mail = new
MailMessage();
try
{
mail.From = new MailAddress("[email protected]", "Subject", System.Text.Encoding.UTF8);
// mail.To.Add(new MailAddress(to));
mail.To.Add(new MailAddress(t));
// mail.Subject = subject;
mail.Body = message;
mail.IsBodyHtml = true;
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
SmtpServer.Send(mail);
}
catch (Exception
err)
{
}
}
Sumit KumawatPosted Dec 19, 2012, 1:53 AM
http://csharp.net-informations.com/communications/csharp-email-attachment.htm
Rohatash KumarPosted Dec 13, 2012, 3:40 AM
This link may be helpful for you:
http://www.c-sharpcorner.com/UploadFile/dchoksi/SendingMail02132007002923AM/SendingMail.aspx
Satyapriya NayakPosted Dec 13, 2012, 1:46 AM