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

Amit KumarRank #459 · 5.4K reputationPosted Oct 5, 2017, 2:49 AM EDT
Ankit SharmaRank #141 · 16.1K reputationPosted Oct 5, 2017, 2:49 AM EDT
Ekrem TapanRank #1,694 · 900 reputationPosted Oct 6, 2017, 2:05 AM EDT
Sundaram SubramanianRank #150 · 15.2K reputationPosted Oct 5, 2017, 9:35 PM EDT
sam samuel89 reputationPosted Oct 5, 2017, 11:14 PM EDT
Ankit SharmaRank #141 · 16.1K reputationPosted Oct 5, 2017, 11:39 PM EDT
Susanta RoutRank #1,557 · 1K reputationPosted Nov 12, 2017, 9:09 PM EST