• Home

Logo

Navigation
  • Home
  • Articles
    • Content Writing
    • Design
    • General
    • Internet Marketing
    • Social Media
    • Tools and Tips
    • Usability
    • Web Hosting Articles
  • Tutorials
    • AJAX Tutorials
    • ASP Tutorials
    • C# Tutorials
    • CGI and Perl Tutorials
    • CSS Tutorials
    • Flash Tutorials
    • HTML Tutorials
    • Illustrator Tutorials
    • Java Tutorials
    • JavaScript Tutorials
    • Linux Tutorials
    • Miscellaneous Tutorials
    • MySQL Tutorials
    • Photoshop Tutorials
    • PHP Tutorials
    • Python Tutorials
    • Wireless Tutorials
    • WordPress Tutorials
    • XML Tutorials
  • Scripts
    • AJAX Scripts
    • ASP Scripts
    • ASP.NET Scripts
    • CGI & Perl Scripts
    • Flash Scripts
    • Java Scripts
    • JavaScript Scripts
    • PHP Scripts
    • Python Scripts
    • Remotely Hosted
    • Tools and Utilities
    • XML Scripts
  • Answers
  • Online Services
  • Tools

Sending HTML Email with ASP

By Amrit Hallan | on Jun 1, 2005 | 0 Comment
ASP Tutorials
  • Tweet
  • Share
  • Tweet
  • Share

Sending HTML Email with ASP

Last time you learnt how to receive or send form data using ASP. Let’s now see how we can send HTML messages using the Active Server Pages. The process is quite similar to sending the regular, text message, but yes, there are a few modifications. Using the code given below, you can send HTML messages:

== Code Begins ==

<%

Dim htmlMess ‘ THIS STORES THE HTML CODE
‘ PLEASE TAKE CARE ABOUT YOUR DOUBLE QUOTES

htmlMess = "<html><head><title>HTML message in Email</title>"

htmlMess = htmlMess & "<style>"

htmlMess = htmlMess & "h1{font-family : Arial; font-size : 16pt; font-weight : bold; color: #000000;}"

htmlMess = htmlMess & "p{font-family : Arial; font-size : 10pt; color: black; text-align : justify;}</style></head>"

htmlMess = htmlMess & "<body bgcolor=’#ffffff’>"

htmlMess = htmlMess & "<h1>My HTML Message from an ASP Page!</h>"

htmlMess = htmlMess = & "<p>This message has been written in HTML format.</p></body></html>"

‘ FIRST I’LL SHOW HOW TO DO IT IN CDONTS, AND THEN IN SMTP

Dim oSendMailer

‘ CDONTS BEGINS

Set oSendMailer = Server.CreateObject("CDONTS.NewMail")

oSendMailer.To = "ToEmail"
oSendMailer.From = "FromEmail"
oSendMailer.Subject = "Subject Matter"

‘ THE FOLLOWING ARE THE EXTRA SETTINGS:
oSendMailer.BodyFormat = 0
oSendMailer.MailFormat = 0

oSendMailer.Body=htmlMess

oSendMailer.Send

set oSendMailer = nothing

‘ CDONTS ENDS

‘ SMTP BEGINS

Set oSendMailer = Server.CreateObject("SMTPsvg.Mailer")

oSendMailer.FromAddress = "FromAddress"

oSendMailer.FromName = "FromName"

oSendMailer.AddRecipient "Recipient Name", "RecipientEmail"

oSendMailer.RemoteHost = "mail.yourdomain.com"

oSendMailer.Subject = "Subject Matter"

oSendMailer.ContentType="Text/HTML"

oSendMailer.BodyText = htmlMess

oSendMailer.SendMail

set oSendMailer = nothing

‘ SMTP ENDS

%>

== Code Ends==

Share this story:
  • tweet

Author Description

Amrit Hallan is a freelance web developer. You can follow the link below to checkout his website.

No Responses to “Sending HTML Email with ASP”

You must be logged in to post a comment.

Connect With Us

RSSSubscribe 0Followers 496Likes
  • Popular
  • Recent
  • Comments
  • Creating Energy Spheres in Photoshop

    Apr 15, 2008 - 96 Comments
  • Easy Screen Scraping in PHP with the Simple HTML DOM Library

    Aug 6, 2008 - 20 Comments
  • Calculating date difference more precisely in PHP

    Mar 7, 2008 - 13 Comments
  • When Does Hosting Your Website in the Cloud Make Sense?

    Oct 8, 2010 - 2 Comments
  • Fun with the Microsoft Managed Extensibility Framework Part 2

    Oct 6, 2010 - 0 Comment
  • Fun with the Microsoft Managed Extensibility Framework Part 1

    Sep 22, 2010 - 0 Comment
  • Website Management on the go with the iPad

    I appreciated your post, but I was looking for something I didn't...
    November 24, 2012 - drmoderator
  • Creating Energy Spheres in Photoshop

    I'm a little stuck down here especially at the step of creating the...
    November 23, 2012 - sarah
  • Running background processes in PHP

    Can you give an example? As see it, you can use this only when you...
    November 16, 2012 - Shaked Klein Orbach
Developer Resources
  • Tutorial Directory
  • Learn HTML
  • Learn PHP
  • Learn CSS
  • Learn AJAX
  • Learn JavaScript
  • Learn Pear
  • White Papers
  • Resources
    • NetVisits Web Directory
    • Realtor Pixels
    • Answers On The Run
    • Ask A Geek
  • Recent Posts

    • When Does Hosting Your Website in the Cloud Make Sense?
    • Fun with the Microsoft Managed Extensibility Framework Part 2
    • Fun with the Microsoft Managed Extensibility Framework Part 1
    • Website Management on the go with the iPad
    • Code Contracts in C# 4.0 – Part 1

    Calendar

    June 2013
    M T W T F S S
    « Oct    
     12
    3456789
    10111213141516
    17181920212223
    24252627282930

    Recent Comments

    • drmoderator on Website Management on the go with the iPad
    • sarah on Creating Energy Spheres in Photoshop
    • Shaked Klein Orbach on Running background processes in PHP
    • Thomas Cuvillier on How To Upload Files Using PHP
    • rizal aditya on Extracting text from Word Documents via PHP and COM
    • Home
    © 2003 - 2013 DeveloperTutorials.com. All Rights Reserved. Privacy Policy.