简体   繁体   中英

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. 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. 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

Would appreciate any guidence.

Thanks in advance.

Will an SMTP gateway be available when the application is published? If so, there are a number of local SMTP host solutions for development environments.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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