简体   繁体   English

过程失败时如何从vb.net控制台应用程序发送电子邮件

[英]How to Sending an email from vb.net console application when a process fails

I am using gmail account to send email...when process fail...like this 我正在使用gmail帐户发送电子邮件...处理失败时...像这样

 Dim SimpleSMTP As New SmtpClient("smtp.gmail.com") 
        With SimpleSMTP 
            .Port = 587 
            .EnableSsl = True 
            .Credentials = _ 
            New NetworkCredential("mytest@gmail.com", "passtest") 
            .Send(AnEmailMessage) 
        End With

I want to replace this snippet with real smtp details...ussmtp.mysite.com How to do it? 我想用真实的smtp详细信息替换此代码段... ussmtp.mysite.com如何执行?

You would just change the URL from "smtp.gmail.com" to "ussmtp.mysite.com" , make sure the port is appropriate, and setup the credentials as needed. 您只需将URL从"smtp.gmail.com"更改为"ussmtp.mysite.com" ,确保端口合适,然后根据需要设置凭据。

Otherwise, the code as written should work with any SMTP server. 否则,编写的代码应适用于任何SMTP服务器。

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

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