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
Jebin Dhanush
NA
40
6k
Sending mail using asp.net
Nov 13 2018 3:08 AM
Hi ,
I have to send mail using private server. But i receive " Failure sending mail. " error
My code
private static void SendMail()
{
try
{
string SmtpHost = ConfigurationManager.AppSettings["SmtpHost"].ToString();
string SmtpFromMail = ConfigurationManager.AppSettings["SmtpFromMail"].ToString();
string SmtpFromMailPwd = ConfigurationManager.AppSettings["SmtpFromMailPwd"].ToString();
//foreach (DataRow dr in objDataTable.Rows)
//{
MailMessage mail = new MailMessage();
mail.To.Add("
[email protected]
");
mail.From = new MailAddress(SmtpFromMail);
//string EventName = DicEventTypeName[dr["Email"].ToString()];
mail.Subject = "Testing";
mail.Body = "Test";
SmtpClient smtp = new SmtpClient();
smtp.Host = SmtpHost; //Or Your SMTP Server Address
smtp.Port = 25;
smtp.Credentials = new System.Net.NetworkCredential(SmtpFromMail, SmtpFromMailPwd); //
smtp.EnableSsl = true;
smtp.Send(mail);
}catch(Exception e)
{
}
}
Could you give any suggestion ?
Thanks in advance !!
Reply
Answers (
3
)
asp.net IIS server
Gridview Column Size Problem