Forums - C# Corner

Forum guidelines
Suresh Babu

Suresh Babu

  • 1.2k
  • 141
  • 11.1k

mail was not sent after hosting the aplication

Sep 14 2013 7:32 AM
plese help me

i had developed a web application.. in my application i need to sent a mail to customer.. if i run my application in local system its the mail was sent successfully. but after hosting the application  the mail was not sent
this is my code

SmtpClient client = new SmtpClient();
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.EnableSsl = true;
            client.Host = "";
            client.Port = 587;

            System.Net.NetworkCredential credentials =
                new System.Net.NetworkCredential("", "suresh57");
            client.UseDefaultCredentials = false;

            client.Credentials = credentials;

            MailMessage msg = new MailMessage();
            msg.From = new MailAddress("");
            msg.To.Add(new MailAddress(to));

            string BccAddress = "";

            msg.Subject = subject;

            msg.Body = body;

                res = true;

            catch (Exception ex)


Answers (2)

Unlimited Flat-Free License


File APIs for .NET
Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!