发送电子邮件失败无法连接远程服务器 [英] Fail Sending Email Unable To Connect the Remote Server

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

问题描述

发送电子邮件时遇到错误。这是错误





这个异常的实际错误是什么,因为我的新手在这里,顺便说一句,这里是我的代码行:



尝试
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()

SmtpServer.Credentials = New _
Net.NetworkCredential(test@gmail.com,passwordexample)
SmtpServer.EnableSsl = True
SmtpServer.Port = 587
SmtpServer.Host =smtp.gmail。 com

mail =新的MailMessage()
mail.From =新的MailAddress(test@gmail.com)
mail.To.Add(examplemail @ gmail。 com)
mail.Subject =更改请求提交
mail.Body =亲爱的用户,&环境新闻环境新闻环境新闻环境新闻已经提交了一个通知,&环境新闻请检查内部网应用程序的更改请求

//广告此行错误SmtpServer.Send(邮件)
SmtpServer.EnableSsl = True
MsgBox(通知电子邮件成功)
Catch ex As Exception
MsgBox(ex.ToString)
结束尝试


解决方案

请看这个答案...



从Visual Basic发送电子邮件



如果仍然无法发送电子邮件....



您是否在Gmail中启用了POP或IMAP?
登录Gmail网络界面。打开设置页面上的转发和POP / IMAP标签,并配置IMAP或POP。在Gmail中启用此功能后,请确保您点击保存更改,以便Gmail可以与您的邮件客户端进行通信。



如果您有两步验证..



获取特定于应用程序的密码
当您在移动设备或电子邮件软件上设置Google Mail时,Google会自动生成一次您只需要一次的密码。您可以轻松地为要使用的每个设备或电子邮件软件生成密码。



步骤1:
在两步验证屏幕的底部,在应用程序专用密码旁边,单击管理应用程序专用密码。



步骤2:
在授权访问您的Google帐户屏幕的名称字段中,键入一个名称,以帮助您记住您正在使用哪些应用程序来访问您的帐户,然后单击生成密码。然后,您将看到一个密码,用于配置您的移动设备或电子邮件软件。保持此屏幕打开,直到您准备好输入密码(见下文第4部分)。使用设备名称创建的密码将显示在底部。使用密码完成后,单击完成。



步骤3:
要为其他设备或电子邮件软件设置密码,只需键入名称在名称字段中,然后单击生成密码。您将收到另一个密码。



在此处查看更多...



http://www.oit.umass.edu/support/google -apps / configure-google-mail-email-software-mobile-devices


im facing error when sending email. here is the error

what is the actual error for this exception because i newbie in in this, by the way here is my code line:

 Try
                Dim SmtpServer As New SmtpClient()
                Dim mail As New MailMessage()

                SmtpServer.Credentials = New  _
                Net.NetworkCredential("test@gmail.com", "passwordexample")
                SmtpServer.EnableSsl = True
                SmtpServer.Port = 587
                SmtpServer.Host = "smtp.gmail.com"

                mail = New MailMessage()
                mail.From = New MailAddress("test@gmail.com")
                mail.To.Add("examplemail@gmail.com")
                mail.Subject = "Change Request Submitted"
                mail.Body = "Dear User, " & Environment.NewLine & Environment.NewLine & Environment.NewLine & Environment.NewLine & "One Notification have been submitted," & Environment.NewLine & "Please check the change request on the intranet application"

//ad this line the error SmtpServer.Send(mail)
                SmtpServer.EnableSsl = True
                MsgBox("Notification emailed successfully")
            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try

解决方案

Please see this answer...

Sending Email from Visual Basic

If you still can't send the email....

Have you enabled POP or IMAP in Gmail? Sign in to the Gmail web interface.Open the 'Forwarding and POP/IMAP' tab on your 'Settings' page, and configure IMAP or POP. After enabling this in Gmail, make sure you click 'Save Changes' so Gmail can communicate with your mail client.

If you have 2 step verification..

Get an Application-Specific Password Google will automatically generate a password that you will need only once, when you set up Google Mail on your mobile device or email software. You can easily generate a password for each device or email software you want to use.

Step 1: At the bottom of the 2-step verification screen, next to Application-specific passwords, click Manage application-specific passwords. The Authorized Access to your Google Account screen will open.

Step 2: On the Authorized Access to your Google Account screen, in the Name field, type in a name to help you remember what application you are using to access your account and click Generate password. You will then see a password which you will use to configure your mobile device or email software. Keep this screen open until you are ready to enter the password (see part 4, below). The password creation with the device name will show at the bottom. When you are done using the password, click Done.

Step 3: To set up a password for another device or email software, simply type in the name of it in the Name field and click Generate password. You will receive another password.

See more here...

http://www.oit.umass.edu/support/google-apps/configure-google-mail-email-software-mobile-devices

这篇关于发送电子邮件失败无法连接远程服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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