logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
Bible Basics
Houseplants
Romance Movies
Creativity
Family Travel
Southwest USA
Irish Culture


dailyclick
All times in EST

Full Schedule
g
g ASP Site

BellaOnline's ASP Editor

g

Sending HTML Mail with ASP


HTML mail is in essence a mail message that has HTML commands in it, instead of just text. It allows the mail message to show images, provide links, and look pretty.

It can get complicated to send a well formatted HTML message. So start with the basics. Read up on Sending a Mail Message with ASP and make SURE you can successfully send messages in regular text. You only want to have to troubleshoot one problem at a time!

OK, so your mail is going out properly. Now you want to send a message with say BOLD LETTERS in it. Again, start small so if you hit a problem you can easily figure out what it is.

Just like before, start out by setting up the to-email, the from-email, and the subject line:

FromEmail = "webmaster@aspisfun.com"
ToEmail = "destination@aspisfun.com"
Subject = "Here is your order confirmation"

next, set up your actual email message. Now that it will be a HTML message, remember to use the P and/or BR commands to separate your paragraps.

EmailMessage = "Thank you for order!<BR>" & CHR(13) & _
"Here are the details of your order.<BR>" & CHR(13) & _
"<B>This Detail Is In Bold</B><BR>" & CHR(13) & _
"...details...<BR>" & CHR(13)

Note that the CHR(13)s just put hard returns after the lines, but in HTML hard returns are ignored.

OK you have your message, with line breaks and a bold part. Now you have to tell the mailer that you want this to be sent as a HTML message and not just as a text message. Otherwise the end user will see lots of HTML commands instead of seeing a pretty message.

Dim objMail
set objMail = CreateObject("CDONTS.NewMail")
Impt = 1
objMail.MailFormat = 0
objMail.BodyFormat = 0

The MailFormat and BodyFormat are what indicate this is a HTML message. Finally, like all good HTML, the HTML has to start and end with a HTML and BODY tag. So adjust your email message to have the proper wrapper.

FinalMessage = "<HTML><BODY> " & _
"<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & _
EmailMessage & "</BODY></HTML>"

Now send the message and close the connection

objMail.Send FromEmail,ToEmail,Subject,FinalMessage,Impt
set objMail = Nothing

There you go! Once you get a basic HTML message going out, you can enhance it with colors, graphics, and much more - just about anything you can do in HTML.

Sending a Mail Message with ASP

Introduction to ASP Ebook

Download this ebook to get everything you need to know about learning ASP - from a step by step tutorial to function lists, sample code, common errors and solutions, and much more! 101 pages.
Add Sending+HTML+Mail+with+ASP to Twitter Add Sending+HTML+Mail+with+ASP to Facebook Add Sending+HTML+Mail+with+ASP to MySpace Add Sending+HTML+Mail+with+ASP to Del.icio.us Digg Sending+HTML+Mail+with+ASP Add Sending+HTML+Mail+with+ASP to Yahoo My Web Add Sending+HTML+Mail+with+ASP to Google Bookmarks Add Sending+HTML+Mail+with+ASP to Stumbleupon Add Sending+HTML+Mail+with+ASP to Reddit




RSS | Related Articles | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


For FREE email updates, subscribe to the ASP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2014 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact Lisa Shea for details.

g


g features
Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Poetry
Daily
Weekly
Monthly
Less than Monthly



BellaOnline on Facebook
g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2014 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor