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
Durga Velusamy
NA
318
114.5k
how to send mail from win form
Nov 21 2015 7:20 AM
error:
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required?
below my code
private void button1_Click(object sender, EventArgs e)
{
try
{
SmtpClient client = new SmtpClient("smtp.gmail.com");
client.Port = 587;
client.EnableSsl = true;
client.Timeout = 100000;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential(
"
[email protected]
", "durga12345678");
MailMessage msg = new MailMessage();
msg.To.Add(textBox1.Text);
msg.From = new MailAddress("
[email protected]
");
msg.Subject = textBox2.Text;
msg.Body = textBox4.Text;
Attachment data = new Attachment(textBox3.Text);
msg.Attachments.Add(data);
client.Send(msg);
MessageBox.Show("Successfully Sent Message.");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void button2_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
textBox3.Text = dlg.FileName.ToString();
}
}
Reply
Answers (
5
)
Face Detection And Saving In Database Sql Server
How to import csv file into mysql database table