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
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Send Email From Windows Application
Chinmaya Dash
Aug 02
2016
Code
1.2
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
public
void
SendEmail()
{
try
{
SmtpClient clientSMTP =
new
SmtpClient(
"smtp.gmail.com"
, 587);
clientSMTP.EnableSsl =
true
;
clientSMTP.DeliveryMethod = SmtpDeliveryMethod.Network;
clientSMTP.UseDefaultCredentials =
false
;
clientSMTP.Credentials =
new
NetworkCredential(
"
[email protected]
"
,
"password"
);
using
(MailMessage message =
new
MailMessage())
{
message.From =
new
MailAddress(
"yourgmailid @gmail.com"
);
message.Subject =
"Subject"
;
message.IsBodyHtml =
true
;
message.To.Add(
"
[email protected]
"
);
message.Body =
"Hi "
+
"Suresh"
+
"!\n"
+
"Welcome to C# Corner!"
+
"Please click here to activate your account. \nThanks!"
;
clientSMTP.Send(message);
}
}
catch
(Exception ex) { }
finally
{ }
}
Send Email Windows Application