using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;
using System.Net;
namespace WebApplication2
{
public partial class ContactUs : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Submit_Click(object sender, EventArgs e)
{
try
{
MailMessage msg = new MailMessage();
msg.To.Add("
[email protected]");
MailAddress address = new MailAddress(txtEmail.Text);
msg.From = address;
msg.ReplyToList.Add(address);
msg.Subject = txtName.Text + " : " + txtSubject.Text;
msg.Body = txtDescription.Text;
SmtpClient client = new SmtpClient("smtp.gmail.com", 25);
client.EnableSsl = true;
NetworkCredential credentials = new NetworkCredential("
[email protected]", "extentia");
client.Credentials = credentials;
client.Send(msg);
lblMessage.Text = "Your message was sent!";
txtEmail.Text = "";
txtSubject.Text = "";
txtName.Text = "";
txtDescription.Text = "";
}
catch
{
lblMessage.Text = "Your message failed to send, please try again.";
}
}
}
}
}
cant able to send mail from my website