Knowledgebase: ASP .NET / ASP
Send a mail from .NET
Posted by - NA - on 07 July 2010 09:30 PM
janwillemb was kind enough to provide everyone with this piece of code to send mail, using SMTP Authentication (the only way to send emails out from our servers in order to reduce spam). Thank you!
To send an email from .NET, use this code:
Dim msg As New MailMessage("firstname.lastname@example.org", "<emailaddress in your domain>")
msg.Subject = "Subject here"
msg.Body = "Body here"
Dim client As New SmtpClient("localhost")
client.Credentials = New Net.NetworkCredential("<email address in your domain>", "<password of this emailaccount>")