简体   繁体   English

从没有SMTP网关的VB.Net发送电子邮件

[英]Send email from VB.Net without SMTP Gateway

I am looking for an alternative to using smtp.gmail.com as they have disabled SMTP relay at my work place. 我正在寻找使用smtp.gmail.com的替代方法,因为他们已在我的工作场所禁用SMTP中继。 And they are adamant they will not make any exceptions. 他们坚决表示,他们不会例外。

I have written an extensive application in VB.net which captures a boat load of requirements from the user. 我在VB.net中编写了一个广泛的应用程序,该应用程序捕获了用户的大量需求。 At the end there is obviously a button to send all the captured data to some recipients. 最后,显然有一个按钮可以将所有捕获的数据发送给某些收件人。 My code is as follows : 我的代码如下:

Private Sub btnEmail_Click(sender As Object, e As EventArgs) Handles btnEmail.Click
    email.From = New MailAddress("kuldip.mond123@gmail.com", "Kuldip Mond")
    email.Subject = "SAP Order Prerequisite Form"
    email.Body = "Message Text as Body of email."
    email.IsBodyHtml = True
    email.To.Add("kmond@mycompany.com")
    smtp.EnableSsl = True
    smtp.Port = 587
    smtp.Host = "smtp.gmail.com"
    smtp.UseDefaultCredentials = False
    smtp.Credentials = New Net.NetworkCredential("kmond@mycompany.com", "*********")
    smtp.Send(email)
    MsgBox("Email Sent")
End Sub

I have considered and read up on SMTP Client with gmail Apps script etc but somewhere sometime sooner or later they all boil down to using a smtp.gmail.com 我已经考虑过并使用gmail Apps脚本等在SMTP客户端上进行阅读,但迟早某个时候它们都会归结为使用smtp.gmail.com

Would appreciate any guidence. 将不胜感激。

Thanks in advance. 提前致谢。

Will an SMTP gateway be available when the application is published? 发布应用程序后,SMTP网关是否可用? If so, there are a number of local SMTP host solutions for development environments. 如果是这样,则有许多用于开发环境的本地SMTP主机解决方案。

I am in the same situation with my IT team myself (no SMTP for dev, but we have access for UAT and Live), and I use the SMTP4Dev ( https://smtp4dev.codeplex.com/ ) application happily. 我本人和我的IT团队处在相同的情况下(开发人员没有SMTP,但是我们可以访问UAT和Live),并且我愉快地使用SMTP4Dev( https://smtp4dev.codeplex.com/ )应用程序。

If you point to the application as your SMTP server, any e-mails sent out using it will be caught by the application and be readable by you. 如果您将该应用程序指向SMTP服务器,则使用该应用程序发送的任何电子邮件都将被该应用程序捕获并被您读取。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM