Knowledgebase: Script Mail
Sending E-Mail using ASP.Net (VB.Net Example)
Posted by Paul Woodland on 30 September 2012 04:11 AM
|
|
If you are sending mail through ASP.Net on your website, you must use SMTP authentication through our Script Mail service, of which details can be found here: ASP.Net includes built-in support for sending using SMTP authentication, no third party components are needed. The auth details can be set in web.config if you do not wish to include them in your code.
Example of sending email through ASP.Net using VB.Net:
Imports System.Net.Mail ' Create the mail message Dim mail As New MailMessage() ' Set the to and from addresses mail.From = New MailAddress("test@yourwebservers.com") mail.To.Add("test@yourwebservers.com") ' Set the subject and body mail.Subject = "Test Message" mail.Body = "This is a test" ' Set the host, username and password Dim smtp As New SmtpClient("uk.scriptmail.yourwebservers.com") smtp.Credentials = New NetworkCredential("YOUR USERNAME", "YOUR PASSWORD") ' Send the message
smtp.Send(mail)
| |
|
Comments (0)