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

问题描述

限时删除!!



i希望创建一个通过gmail发送电子邮件的应用程序,但不起作用。

我试着看看我是否到达服务器smtp.gmail。通过telnet(telnet smtp.gmai.com 465)在端口465上运行。这可以。

预先感谢您的帮助



这个是代码:

Sub Main()

Dim SmtpServer作为新的SmtpClient()

SmtpServer.Port = 465

SmtpServer.Host =smtp.gmail.com

SmtpServer.EnableSsl = True

SmtpServer.UseDefaultCredentials = False

SmtpServer.Timeout = 8000

SmtpServer.Credentials = New Net.NetworkCredential([email protected],密码)



Dim m作为New MailMessage

m.To.Add([email protected]

''m.From = New MailAddress(mail-from @ gmail .com)

m.Body =测试消息

m.Subject =测试苏对象

尝试

SmtpServer.Send(m)

Catch ex As Exception

MsgBox(ex.ToString ())

结束尝试



结束Sub

Hi,
i want to create a application that send email via gmail, but does not work.
I tried to see if I reached the server smtp.gmail.com on port 465 via telnet (telnet smtp.gmai.com 465) and this works.
Thanks in advance for your help

this is code:
Sub Main()
Dim SmtpServer As New SmtpClient()
SmtpServer.Port = 465
SmtpServer.Host = "smtp.gmail.com"
SmtpServer.EnableSsl = True
SmtpServer.UseDefaultCredentials = False
SmtpServer.Timeout = 8000
SmtpServer.Credentials = New Net.NetworkCredential("[email protected]", "Password")

Dim m As New MailMessage
m.To.Add("[email protected]")
''m.From = New MailAddress("[email protected]")
m.Body = "Test Message"
m.Subject = "Test Subject"
Try
SmtpServer.Send(m)
Catch ex As Exception
MsgBox(ex.ToString())
End Try

End Sub

推荐答案

SmtpServer.Port = 587


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

1403页,肝出来的..

09-08 21:49