C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Solution: The server response was: 5.7.0 Must issue a STARTTLS command first. i16sm1806350pag.18 - gsmtp
WhatsApp
Nitesh Kejriwal
10y
91.6
k
0
0
25
Blog
Friends,
When sending emails via code using Gmail as mail server, we sometime get this error. This blog post explains the error and the solution to the same.
The error occurs when the code tries to authenticate Gmail server using the given credentials over non-SSL layer and does not encrypt the connection.
To resolve this, you need to set
EnableSsl
property of your SmtpClient class's object to true as mentioned below -
SmtpClient client =
new
SmtpClient(
"smtp.gmail.com"
);
client.EnableSsl =
true
;
Hope you like this. Keep learning and sharing! Cheers!
People also reading
Rebin Infotech
Think. Innovate. Grow.
Membership not found