TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Raja Priya Meganathan
NA
194
7.3k
Trying to send the message to my Gmail account.
Mar 1 2021 1:00 PM
I'm trying to send the message to my Gmail account through SMTP. And here is my code.
try
{
MailMessage msg =
new
MailMessage();
msg.From =
new
MailAddress(
"
[email protected]
"
);
msg.To.Add(
"
[email protected]
"
);
msg.Subject =
"test"
;
msg.Body =
"Test Content"
;
msg.Priority = MailPriority.High;
SmtpClient client =
new
SmtpClient();
client.UseDefaultCredentials =
false
;
client.Credentials =
new
NetworkCredential(
"
[email protected]
"
,
"123"
,
"smtp.gmail.com"
);
client.Host =
"smtp.gmail.com"
;
client.Port = 587;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.EnableSsl =
true
;
client.Send(msg);
}
catch
(Exception ex)
{
throw
ex;
}
It's throwing the exception "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required"
Reply
Answers (
6
)
Can I develop hotspot file sharing desktop application with c#?
Default printer setting is changed in windows.