Sending email from ASP.Net

Sending E-mails from ASP.Net

Step 1: Place the following in your web.config file, making sure to replace the username and password fields with a valid inbox created from within the control panel:

<configuration>
<!-- Add the email settings to the <system. net> element -->
   <system.net>
      <mailsettings>
         <smtp>
               <network host="relayServerHostname" port="portNumber" userName="username" password="password" />
      <system.net>
</configuration>


Step 2: From within the page, use the code below replacing the from, to, subject, and body fields:

Dim mm As New MailMessage()
mm.From = New MailAddress("Fromanyone@somedomain.com", "John Doe")
mm.To.Add(New MailAddress("FirstRecipient@recipientdomain.com"))
mm.To.Add(New MailAddress("SecondRecipient@seconddomain.com"))
mm.Subject = "Subject line"
mm.Body = "This is the message...it can include html tags for formatting"
mm.IsBodyHtml = True
Dim smtp As New SmtpClient
smtp.Send(mm)

  • 28 Users Found This Useful
Was this answer helpful?

Related Articles

Sending mail with Joomla websites

1. Enter your Joomla dashboard. 2. Click on "Site", "Global configuration". 3. Choose the...

Sending smtp mail with wordpress

We do not allow any mails to be relayed without first authenticating to our mail servers,...

Sending email from asp pages

This portion goes into the header portion of the page before the  tag.   (Just remove the space...

Sending emails from a website using ASP

Please use the following ASP code to send e-mails, note that our mail servers require SMTP...

Sending Email from PHP

Sending E-mail from PHP For Sending external emails from websites to to domains that do not...