Click here to Skip to main content
15,883,535 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
I just want a confirmation Email on Click of a Registeration form on my email id that this particular UserName, MobileNo, Age has Register on my Website on Click of a Button Register Now


What I have tried:

I have tried this one and got error that Failure sending Email

SmtpClient client = new SmtpClient();
client.Host = "smtp.googlemail.com";
client.Port = 587;
client.UseDefaultCredentials = false;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.EnableSsl = true;
client.Credentials = new NetworkCredential("myemail@gmail.com", "password");
client.Send(Message);
Posted
Updated 19-Jul-16 23:09pm
Comments
Suvendu Shekhar Giri 20-Jul-16 2:54am    
...and what is problem?
did it give any error?
Khan Sameer 20-Jul-16 3:00am    
The remote name could not be resolved: 'smtp.googlemail.com'
Bernhard Hiller 20-Jul-16 3:39am    
That means that DNS is not setup correctly on the server. Tell your provider to correct that.
Hein Pauwelyn 20-Jul-16 4:14am    
place do your code in pre-tags and your text in p-tags and not vise versa.

1 solution

Change
C#
client.Host = "smtp.googlemail.com";

to
C#
client.Host = "smtp.gmail.com";
 
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