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
Aniruddha Acharya
NA
304
20.2k
message sending on email id by website
Nov 27 2019 5:49 AM
Hi,
I am using this code for send mail message from my website: This Code is running on local host, but when i updated on server then not working.
protected void buttonSend_Click(object sender, EventArgs e)
{
try
{
SmtpClient client = new SmtpClient("smtp.gmail.com",587);
client.EnableSsl = true;
client.Timeout = 10000;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential("EmailID", "Password");
MailMessage msg = new MailMessage();
msg.To.Add("EmailID");
msg.From = new MailAddress( textBoxTo.Text);
msg.Subject = textBoxSubject.Text;
msg.Body = " Name = " + textBoxName.Text + "" + "\n" + " Mobile Number: " + textBoxMobile.Text + "" + "\n" + " This Mail is from = " + textBoxTo.Text + " " + "\n" + " Subject = " + textBoxSubject.Text + " " + "\n" + " Message = " + textBoxMsg.Text + " ";
client.Send(msg);
lblMessageBox.Text = ("Mail Sent successfully!!!");
}
catch (Exception ex)
{
lblMessageBox.Text = ex.ToString();
}
}
Reply
Answers (
6
)
How to handle stackoverflow problem
Duplicate Record is inserting in DB in ASP.NET WEB API