vb.net 发送电子邮件

标签 vb.net email

我想知道如何从 vb 应用程序中发送电子邮件?任何人都可以协助从哪里开始?

最佳答案

使用 SmtpClient class within the System.Net.Mail namespace

例子。

'create the mail message
Dim mail As New MailMessage()

'set the addresses
mail.From = New MailAddress("xx@xx")
mail.[To].Add("xx@xx")

'set the content
mail.Subject = "This is an email"
mail.Body = "this is a sample body"

'set the server
Dim smtp As New SmtpClient("localhost")

'send the message
Try
    smtp.Send(mail)
    Response.Write("Your Email has been sent sucessfully - Thank You")
Catch exc As Exception
    Response.Write("Send failure: " & exc.ToString())
End Try

关于vb.net 发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4862649/

相关文章:

vb.net - 在ActiveReports中设置水印

Java 到 VB.Net 的转换 [小片段]

vb.net - "Conversion from string ""to type ' 双' is not valid."在VB

java - spring-boot-starter-mail 使用后的 "Application failed to start"

.net - SqlDataAdapter 未更新

vb.net - 尝试 - 多线程 - 在 VB.net Windows 窗体中

python - 使用我的雅虎帐户发送电子邮件 - 错误消息

r - sendmailR(第2部分):将文件作为邮件附件发送

email - 创建电子邮件帐户时出现 cPanel 错误。错误 : No specific error was returned with the failed API Call

php - 使我的电子邮件表格列响应流畅的问题