tags:

views:

46

answers:

1

I need a simple email function that just sends an email (not looking to spam anyone I promise!).

Anyone, anyone? Using VB 2008

+5  A: 

Use the SmtpClient class to do this. There's an example of sending an email asynchronously on the documentation page, but here's a basic way of doing it:

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)
womp