2010-02-06 78 views
2

我需要一個簡單的電子郵件功能,只是發送一封電子郵件(不希望垃圾郵件任何人,我保證!)。電子郵件功能在VB

任何人,任何人?使用VB 2008

+0

重複這種http://stackoverflow.com/questions/57919/best-way-to-send -an-電子郵件從-A淨應用 – MarkJ 2010-02-06 12:22:51

回答

7

使用​​類來完成此操作。還有的文檔頁面異步發送電子郵件的例子,但這裏的做這件事的基本途徑:

Dim client As New SmtpClient("mail.myisp.com") 

Dim fromAddr As New MailAddress("[email protected]") 
Dim toAddr As New MailAddress("[email protected]") 
Dim message As New MailMessage(fromAddr, toAddr) 
message.Body = "This is a test e-mail message sent by an application. " 
message.Subject = "test message 1" 

client.Send(message)