Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am new in programming please help me to solve this problem i have to send a message from and to my own email.

The error is:

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at

What I have tried:

C#
SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
            MailMessage mm = new MailMessage("musafirbalti@gmail.com", "musafirbalti@gmail.com");
            mm.Subject = "abc";
            mm.Body = "ansdjfskhfsa d fjk h sjh  sdhf hskd";
            smtp.Credentials = new System.Net.NetworkCredential("mymail@gmail.com", "mypasword");
            smtp.EnableSsl = true;
            smtp.Send(mm);
            TextBox1.Text = "the email is been sended to the reciver";
Posted
Updated 26-Jun-17 1:42am
v2
Comments
Afzaal Ahmad Zeeshan 26-Jun-17 11:31am    
Just double check, whether your account information is correct and that this is not a new account. Google needs to know that this is you, using the account and not a spammy bot.

Gmail SMTP port (SSL): 465
See: What Are the Gmail SMTP Server Settings?[^]
 
Share this answer
 
You first check your gmail account has two steps verification is on or not. If on then you must off two steps verification.
 
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