سلام به همه دوستان

من یه صفحه تماس با ما درست کردم که در این صفحه نظرات کاربران به ایمیل مدیر ارسال میشه، همه چیز در لوکال درست کار میکنه ولی نمیدونم چرا در هاست پلسک خطای زیر رخ میده

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at



کد ارسال ایمیل :

MailMessage msg = new MailMessage();

msg.From = new MailAddress(txtMail.Text, txtMail.Text, new UTF8Encoding());
msg.ReplyTo = msg.From;
msg.Sender = new MailAddress(txtMail.Text, txtMail.Text, new UTF8Encoding());
msg.Subject = "نظرات";
msg.IsBodyHtml = true;
msg.Body = TextBox1.Text;

SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential("sanapishro.tech@gmai l.com", "*****");
msg.To.Add("sanapishro.tech@gmail.com");



تنظیمات web.config:

<system.net>
<mailSettings>
<smtp from="sanapishro.tech@gmail.com" deliveryMethod="Network">
<network defaultCredentials="false" host="smtp.gmail.com" port="587" userName="sanapishro.tech@gmail.com" password="*****" enableSsl="true"/>
</smtp>
</mailSettings>
</system.net>