Click here to Skip to main content
15,904,935 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when am send the mail in local it send to email but when its is online it cant be sent below is my code plz help me
C#
string vbody = "Thank you for your valueble feedback. Soon we will reach to you! <br />";
           vbody = vbody + "With Regards <br />";
           vbody = vbody + "Support Team -";
           vbody = vbody + "BOOK MOVIE TICKET";
           MailMessage msg = new MailMessage();
           msg.To.Add(txt_email.Text);
           msg.From = new MailAddress("bookmovieticket4u@gmail.com", "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("bookmovieticket4u@gmail.com", "password");
           smtp.Send(msg);
Posted
Updated 14-Jun-13 1:36am
v2
Comments
Alexander Dymshyts 14-Jun-13 7:37am    
Hope this links will help you - http://www.codeproject.com/Tips/520998/Send-Email-from-Yahoo-Gmail-Hotmail-Csharp or http://www.codeproject.com/Tips/163829/Sending-an-Email-in-C-with-or-without-attachments
BHABANI PRASAD DASH 14-Jun-13 8:13am    
No am not getting any error
Do you get any exceptions?
Sunasara Imdadhusen 14-Jun-13 8:05am    
Are you getting any error?
yourfriendaks 14-Jun-13 8:41am    
i checked ur code is working..
tell me what type of error u got when its online..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900