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

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

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

Hi dear,

using System.Net.Mail;

private void MailSend()
       {
           try
           {
               MailMessage mail = new MailMessage();
               SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
               SmtpServer.Host = "smtp.gmail.com";

               mail.From = new MailAddress("FromMailName@gamil.com");
               mail.To.Add("ToMailName@gmail.com");
               mail.Subject = "Test Mail";
               mail.Body = "This is for testing SMTP mail from GMAIL";

               SmtpServer.Port = 587;

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

               SmtpServer.Send(mail);
           }
           catch (Exception ex)
           {
               MessageBox.Show(ex.ToString());
           }
       }


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
 
v2
u need a smtp mail server ...
 
Share this answer
 
Hi,

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