Reputation: 599
I am trying to send an email but i am getting authentication failure.
Do we need any specific type of authentication for Google mail.
[Error in Browser][1]
// Created Mail message and taken inputs
MailMessage mail = new MailMessage(from,to,subject,message);
// Used SMTP Client
SmtpClient client = new SmtpClient();
// Google Port
client.Port = 587;
client.Credentials = new NetworkCredential(From.Text, password.Text);
client.UseDefaultCredentials = true;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.EnableSsl = true;
client.Send(mail);
Label.Text = "Sent Successful";
I am getting error near Send(mail)
Upvotes: 0
Views: 732
Reputation: 397
You're not setting the SMTP server address?
Assuming your credentials are correct then you should use SmtpClient client = new SmtpClient("smtp.gmail.com")
and client.Port = 465
. 587 is for TLS
Upvotes: 1