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
shilpa mittal
NA
9
6.9k
send email probleum
Aug 2 2014 1:38 PM
MailMessage msg = new MailMessage();
msg.From = new MailAddress(txtEmail.Text);
msg.To.Add("mymailid");
msg.IsBodyHtml = true;
msg.Body = "<b>Name : </b>" + txtname.Text + "<br/><br/><b> Email : </b>" + txtEmail.Text + "<br/><br/><b> Phone : </b>" + txtmobile.Text + "<br/><br/><b> Message : </b>" + Txtmessage.Text + "<br>";
msg.Subject = txtSubject.Text;
SmtpClient smtpclient = new SmtpClient();
smtpclient.Host = "smtp.gmail.com";
smtpclient.Port = 587;
smtpclient.Credentials = new System.Net.NetworkCredential("mymailid", "password");
smtpclient.EnableSsl = true;
smtpclient.Send(msg);
Label1.Text = "Thanks for contacting us";
txtname.Text = "";
txtEmail.Text = "";
txtSubject.Text = "";
Txtmessage.Text = "";
txtmobile.Text = "";
}
catch(Exception ex)
{
Console.WriteLine("{0} Exeception caugh.",ex);
}
this code of mine working on local host but not working when i put it on server can an one suggest me what to do.
Reply
Answers (
5
)
New Website
Want Code on Session views and query strings