Gmail Error :The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required
This generally happens when you try login from different time zone or IP Address Computer. Your production server and the mail id you have used both are in different time zone. Choose either of these two solutions:
1) Log in to production server via remote access, and sign in to gmail once with your credentials. They will ask for the confirmation, confirm it and log out.
Or 2) log in gmail to your local computer, Follow this Link and choose review this activity and take proper actions.
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required?
First check for gmail's security related issues. You may have enabled double authentication in gmail. Also check your gmail inbox if you are getting any security alerts. In such cases check other answer of @mjb as below
Below is the very general thing that i always check first for such issues
client.UseDefaultCredentials = true;
set it to false.
Note @Joe King's answer - you must set client.UseDefaultCredentials before you set client.Credentials
the SMTP server requires a secure connection or the client was not authenticated. The server response was 5.5.1, Authentication required
Check your gmail account and turn on "Acess for less secure apps"
Set
client.UseDefaultCredentials = false;
beforeclient.Credentials = new NetworkCredential("Sender email", "Sender email password");
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. In html
Your errors...
The SMTP server requires a secure connection or the client was not authenticated.
- Are you running on HTTPS?
- You didn't provide proper authentication. You do realize you need your real email address (the
username
attribute; you're using Gmail, so you have to provide your Gmail address) and your real password to send emails from your account, right? (That includes thefrom
field.) Gmail also has some extra complications. See this post on how to send emails from Gmail.
Mailbox name not allowed. The server response was: Envelope FROM 'hi@gmail.com' email address not allowed.
You tried to send an email from "hi@gmail.com". Do you think it will work? Let's pretend your email is bob@gmail.com
. If what you attempted didn't result in an error, that means that I can send an email from your email without your permission! So no, that rightly shouldn't work.
All else aside, please don't try to send emails from the client-side. You realize that if you publish your app everyone can see your email address
and password, right?
Related Topics
What's Wrong With Using Thread.Abort()
Decimal VS Double! - Which One Should I Use and When
Convert List≪Derivedclass≫ to List≪Baseclass≫
How to Limit the Amount of Concurrent Async I/O Operations
C# Interfaces. Implicit Implementation Versus Explicit Implementation
How to Create a Dropdownlist from an Enum in ASP.NET MVC
Performance Differences Between Debug and Release Builds
Creating a Byte Array from a Stream
How to Copy the Contents of One Stream to Another
Why Is Floating Point Arithmetic in C# Imprecise
Send Values from One Form to Another Form
Sending Email Through Gmail Smtp Server With C#
How to Pass Data (And References) Between Scenes in Unity
Pass List of Checkboxes into View and Pull Out Ienumerable
Deserialize Json Object into Dynamic Object Using Json.Net