Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# SMTP mailing
here is my code:
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
                    message.Subject = "Nici un Clinet valabil pentru reparare";
                    message.From = new System.Net.Mail.MailAddress("");
                    message.Body = "Nu mai sunt clienti la care mecanicii sa lucreze";
                    string sendEmailsFrom = "";
                    string sendEmailsFromPassword = "my_invisible_password";
                    System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("", 587);
                    smtp.EnableSsl = true;
                    smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
                    smtp.Credentials = new NetworkCredential(sendEmailsFrom, sendEmailsFromPassword);
                    smtp.Timeout = 20000;
And my error:
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
What is the problem? i can't see it and can't find a solution on google.
Sas Gabriel
Posted 12-Nov-12 10:48am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You need to set
UseDefaultCredentials = false;
first and after that set the credentials you want to use
Credentials = new NetworkCredential("", "my_invisible_password");
Also make sure you can login from with your username and password from the page.
Good luck,
Gabriel Sas at 12-Nov-12 17:04pm
also the password wasn't the good one, thanks
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Also please be aware that google will block you from logging in when you do to much connection attempts.
I always use a local email server for development:[^]
It's free. You can simply configure it and run it on your computer, connecting to localhost:2525.
Please be sure to also turn down the ban-option ("auto-ban") of this one.

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

  Print Answers RSS
0 OriginalGriff 393
1 Sergey Alexandrovich Kryukov 232
2 Richard Deeming 180
3 Snehasish_Nandy 171
4 ChauhanAjay 170
0 Sergey Alexandrovich Kryukov 6,367
1 OriginalGriff 5,588
2 CPallini 2,473
3 Richard MacCutchan 1,627
4 Abhinav S 1,530

Advertise | Privacy | Mobile
Web04 | 2.8.140821.2 | Last Updated 13 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100