المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : did you Google Block Gmail?!



C# Programming
03-29-2010, 07:50 PM
I am using this code to send email through Gmailand everything was fine until recently.. I am now getting this error:

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.What's the problem?!!

This is is code I was using for long time already:

NetworkCredential loginInfo = new NetworkCredential(gMailAccount, password);
MailMessage msg = new MailMessage();

msg.Sender = new MailAddress(from, displayname);
msg.ReplyTo = new MailAddress(from, displayname);
msg.From = new MailAddress(from, displayname);
msg.To.Add(new MailAddress(to, "Jassim Rahma"));
msg.Subject = subject;
message = message.Replace(@"\r\n", Environment.NewLine);
msg.Body = message;
msg.Priority = MailPriority.High;
msg.IsBodyHtml = true;

Attachment mail_attachment = new Attachment(Application.StartupPath + "\\rbuilder.log");

if (technical_data == true)
{
msg.Attachments.Add(mail_attachment);
}

SmtpClient client = new SmtpClient("smtp.gmail.com");
client.Port = 587;
client.EnableSsl = true;
client.UseDefaultCredentials = false;
client.Credentials = loginInfo;
client.Send(msg);

MessageBox.Show("Thank you." +Environment.NewLine + Environment.NewLine + "Your email was receieved.", "Feedback", MessageBoxButtons.OK, MessageBoxIcon.Information);

return true;