Click here to Skip to main content
15,905,148 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:

I am using SMTP client for sending mails, while sending mail it shows error as follows ;

Failure sending mail

Please someone help to resolve this problem

Anele Ngqandu 3-Dec-12 4:30am    
where is your code boss?

Hi dear,

using System.Net.Mail;

private void MailSend()
               MailMessage mail = new MailMessage();
               SmtpClient SmtpServer = new SmtpClient("");
               SmtpServer.Host = "";

               mail.From = new MailAddress("");
               mail.Subject = "Test Mail";
               mail.Body = "This is for testing SMTP mail from GMAIL";

               SmtpServer.Port = 587;

               SmtpServer.Credentials = new System.Net.NetworkCredential("", "123456"); // User Mail Name And Mail Password
               SmtpServer.EnableSsl = true;

           catch (Exception ex)

If you like this solution plz vote.
Share this answer
Similar thread is here : Failure Sending Mail[^]... This could help you :0
Share this answer
Hi Mohan...

I was also facing the same problem, for solving the problem I called my mail server provider, they told they did not support SMTP server.

So my suggestion is, you will have to confirm with your service provider
whether they are provide SMTP service or not.

Best of luck

Amit Vishwakarma
Share this answer
u need a smtp mail server ...
Share this answer

There are some issues in sending mail by Using SMTP Credential ,
1. First Check is there any antivirus is running on system.if its running on system disable it.
2. Check your SMTP Credential.
3.Check Port is OPEN or NOT (25/587).

Best Luck...
Share this answer

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