03 Sep 2010 
Support Center » Knowledgebase » E-Mail » How to send email using ASP.NET2 VB
 How to send email using ASP.NET2 VB
Solution 'This is an example only, and needs to be modified with proper information


Sub SendEmail()

'create the mail message
Dim nmail As New System.Net.Mail.MailMessage

'set the addresses
nmail.To.Clear()
nmail.To.Add(New System.Net.Mail.MailAddress("recipient name "))
nmail.From = New System.Net.Mail.MailAddress("my name ")

'set the content
nmail.Subject = "This is an email"
nmail.Body = "this is the body content of the email."

'prepare to send the message
Dim smtp As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient("mail.mydomain.tld")

'you need to use the credentials of an existing mail account
smtp.Credentials = New System.Net.NetworkCredential("me@mydomain.tld", "mypassword")

Try
smtp.Send(nmail)
Catch ex As Exception
Response.Write("Error: " & ex.ToString())
End Try

End Sub


Article Details
Article ID: 61
Created On: 15 May 2007 01:51 PM

 Back
 Login [Lost Password] 
Email:
Password:
Remember Me:
 
 Search
 Article Options
Home | Register | Submit a Ticket | Knowledgebase | Troubleshooter | News | Downloads
Language:

Help Desk Software Help Desk Software By Kayako SupportSuite v3.70.02