TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sam samuel
NA
112
6.6k
How to send mail from asp.net
Oct 5 2017 6:39 AM
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
Reply
Answers (
7
)
Is it Mandatory to add another Architecture
Windows server 2012 & MS-SQL Express 2012