邮件发送失败。 [英] Failure sending mail.

查看:158
本文介绍了邮件发送失败。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有邮件发送代码,直到昨天工作正常但现在即将面临错误发送邮件失败。我已检查用户名和密码,其正确的端口是正确的但仍然我得到这个错误请建议解决方案这里是我的代码



我试过的:



< pre>尝试

Dim sb As New StringBuilder()

Dim message As MailMessage = New System.Net.Mail.MailMessage(mailid@gmail.com,txtEmail.Text。 Trim(),txtSubject.Text,txtMessage.Text)

Dim smtp As New SmtpClient()

smtp.Host =smtp.gmail.com

smtp.Port = 587

smtp.Credentials = New System.Net.NetworkCredential(mailid@gmail.com,Password)

smtp。 EnableSsl = True

message.IsBodyHtml = True


smtp.Send(message)

Response.Write(< script> ;警告('感谢联系我们')< / script>)
'清除文本框值
txtName.Text =
txtSubject.Text =
txtMessage.Text =
txtEmail.Text =
Catch ex As Exception
结束尝试

解决案
报价:
将设置更改为允许安全性较低的应用访问您的帐户。如果您仍想允许访问,请按以下步骤操作:

转到我的帐户中的安全性较低的应用部分。

旁边的访问不太安全的应用, 选择开启。

如果您仍无法登录自己的帐户,可能会因其他原因导致密码错误错误。


I have mail sending code which works fine till yesterday but now im facing a error Failure sending mail. i have checked for user name and password its correct the port is correct but still im getting this error please suggest solution here is my code

What I have tried:

<pre> Try

            Dim sb As New StringBuilder()

            Dim message As MailMessage = New System.Net.Mail.MailMessage("mailid@gmail.com", txtEmail.Text.Trim(), txtSubject.Text, txtMessage.Text)

            Dim smtp As New SmtpClient()

            smtp.Host = "smtp.gmail.com"

            smtp.Port = 587

            smtp.Credentials = New System.Net.NetworkCredential("mailid@gmail.com", "Password")

            smtp.EnableSsl = True

            message.IsBodyHtml = True


            smtp.Send(message)

            Response.Write("<script>alert ('Thanks for Contact us')</script>")
            ' Clear the textbox valuess
            txtName.Text = ""
            txtSubject.Text = ""
            txtMessage.Text = ""
            txtEmail.Text = ""
        Catch ex As Exception
        End Try

解决方案

Quote:

Change your settings to allow less secure apps to access your account. If you want to allow access anyway, follow these steps:
Go to the "Less secure apps" section in My Account.
Next to "Access for less secure apps," select Turn on.
If you still can't sign in to your account, the "password incorrect" error might be caused by a different reason.


这篇关于邮件发送失败。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆