in offline i can send mail but in online itdoesnt send
code is in belowstring vbody = "Thank you for your valueble feedback. Soon we will reach to you!
";
vbody = vbody + "With Regards
";
vbody = vbody + "Support Team -";
vbody = vbody + "BOOK MOVIE TICKET";
MailMessage msg = new MailMessage();
msg.To.Add(txt_email.Text);
msg.From = new MailAddress("urusername", "Book Movie Ticket Help Desk");
msg.IsBodyHtml = true;
msg.Body = vbody;
msg.Subject = "Thank you for your feedback";
SmtpClient smtp = new SmtpClient("smtp.gmail.com");
smtp.EnableSsl = true;
smtp.Port = 587;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Credentials = new NetworkCredential("urusername"
smtp.Send(msg);
msg = null;
but no error come

Bhabani prasad DashPosted Jun 17, 2013, 4:48 AM
sapana firkePosted Jun 17, 2013, 4:47 AM
minu khandelwalPosted Jun 17, 2013, 3:18 AM
string FromAddress = ConfigurationManager.AppSettings["FromAddress"].ToString();
string ToAddress = usr.Email;
MailMessage mail = new MailMessage(FromAddress, ToAddress, "Reset your password", sbody.ToString());
mail.Body = body;
mail.IsBodyHtml = true;
System.Net.Mail.Attachment imgAtt = new System.Net.Mail.Attachment(Server.MapPath("~/images/Test.png"));
//give it a content id that corresponds to the src we added in the body img tag
imgAtt.ContentId = "sashakta-dms.png";
//add the attachment to the email
mail.Attachments.Add(imgAtt);
SmtpClient mailClient = new SmtpClient();
mailClient.EnableSsl = true;
object obMsg = mail;
mailClient.SendCompleted += new SendCompletedEventHandler(CatchEmailSent);
mailClient.DeliveryMethod = SmtpDeliveryMethod.Network;
mailClient.Send(mail);
Bhabani prasad DashPosted Jun 17, 2013, 2:48 AM
Sunny SharmaPosted Jun 17, 2013, 2:46 AM
Believe me... your codes have no problem, they're working like a charm. I suggest you check for your sent email in Junk/Spam folder in the recipient's mail box.
Happy Coding :)
Cheers!