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
User Comments
Add a Comment
Sharing is good. So if you have a comment about this entry please feel free to share. The Comments might be reviewed by our Staff and might require approval before being posted. Questions posted will not be answered, please submit a ticket for support requests.
Image verification required
Please enter the characters that appear to the right in the space provided. This is just to verify that you are a human.
Fullname:
Email: (Optional)
Comments:
Back
Login
[Lost Password]
Email:
Password:
Remember Me:
Search
-- Entire Support Site --
Knowledgebase
Downloads
Troubleshooter
Article Options
Add Comment
Print Article
PDF Version
Email Article
Add to Favorites
Home
|
Register
|
Submit a Ticket
|
Knowledgebase
|
Troubleshooter
|
News
|
Downloads
Language:
English (U.S.)
Help Desk Software
Help Desk Software By Kayako SupportSuite v3.70.02