如何通过代理服务器发送vb.net Windows应用程序电子邮件? [英] How to send vb.net windows application email over proxy server?
本文介绍了如何通过代理服务器发送vb.net Windows应用程序电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我需要创建一个小报告以从VB.NET Windows应用程序自动发送.我写了下面的代码,这些代码可在我的私人PC上运行,并具有Gmail设置,例如用户名+密码+ smtp.gmail.com等...
但是,我的工作信息(如我的代理ID +代理密码+公司smptserver +端口25)无法正常工作.
我是否在代码中缺少某些行:
Hello,
I need to create a small report to be send automaticliy from VB.NET Windows application. I have wrote below code which is working on my private PC, and with Gmail settings, such as username + password + smtp.gmail.com, etc...
But with, my work informations, like my proxy ID + proxy password + company smptserver + port 25, does not working .
Do I missing some lines in my code:
Imports System.Net.Mail
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Mail As New MailMessage
Mail.Subject = "test email"
Mail.To.Add("emailaddress")
Mail.From = New MailAddress("emailaddress")
Mail.Body = TextBox1.Text
Dim SMTP As New SmtpClient("smtpserver")
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("username", "password")
SMTP.Port = 25
SMTP.Send(Mail)
End Sub
预先感谢您的帮助.
Thank you in advance for help.
推荐答案
Google的电子邮件未使用端口25:
请参阅此处 [
Google does not use port 25 for its email:
see here[^]
好,我们使用的是MS Exchange服务器,而我使用的是Outlook.并且,端口为25.
Well, we are using MS Exchange server, and me as client using Outlook. And, port is 25.
已找到解决方案. SSL线路不需要ti.
SMTP.EnableSsl = True
Found as solution. SSL line is no need ti.
SMTP.EnableSsl = True
这篇关于如何通过代理服务器发送vb.net Windows应用程序电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文