Blog Tools
Edit My Blog
RSS Feed RSS
About Me
Contact Me

< < Feb 2008 > >
S M T W T F S
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29  
You are not signed in.
Sign in

Entries By Topic
·All Topics RSS
·ASP.NET RSS
·ASP.NET Web Pages (Razor) RSS
·Classic ASP RSS
·Cool Websites RSS
·Databases RSS
·eBay/PayPal RSS
·General RSS
·Hardware RSS
·HTML/CSS RSS
·Jquery/Javascript RSS
·Media Center RSS
·Mobile Phones RSS
·Web Design RSS
·Web Security RSS
·Windows XP RSS

Search
 
Recent Entries
·jobs.nsw - web user interface design at its worst
·eBay Tip: How to find what best offers have been accepted
·eBay Changes Starting 22 September 2011
·You've heard of Shazam, but there are alternatives
·The Commodore 64 Lives On
·Jquery/Javascript plugin to truncate text to fit container height and width
·Multiple Projects in Visual Web Developer 2010 (VWD)
·Installing ASP.NET Web Pages Helpers in Visual Web Developer 2010
·Connecting to MySQL Database with ASP.NET Web Pages (Razor)
·Finally... A Replacement for Classic ASP

John's Technology Blog

VBScript Class to Send Mail With CDOSYS

Posted at: February 16, 2008
Related Topic(s): Classic ASP

This is my first attempt at a VBScript class.

It allows full control of the CDO Message object.

You can create a new instance of the class with the following:

Dim clsSendMail
Set clsSendMail = New SendMail

Then add the various properties of the email:

clsSendMail.SendTo = "test@test.com"
clsSendMail.From = "test@test.com"
clsSendMail.Subject = "Test Message"

Next you choose what type of mail you are going to send: plain text, HTML or from a URL or local file.

Type Property/Method Syntax
Plain Text TextBody clsSendMail.TextBody = "message here"
HTML HTMLBody clsSendMail.HTMLBody = "<b>html</b> message here"
URL CreateMHTMLBody Call clsSendMail.CreateMHTMLBody "http://www.url.com/pagename.htm"
Local File CreateMHTMLBody Call clsSendMail.CreateMHTMLBody "file://c:/mydocuments/test.htm"

To add an attachment use the following:

Call clsSendMail.AddAttachment "c:\mydocuments\test.txt"

To embed files in your message use:

clsSendMail.AddRelatedBodyPart "/older/imagefile.gif", "image1.gif"

This can then be included in your HTMLBody by referencing the second parameter as the CID, for example:

<img src="cid:image1.gif">

You can also set a SMTP server and port if neccessary:

Call clsSendMail.SMTPServer "mail.test.com", 25

SendMail Class


View Comments (0) | Add Comment | Permalink

Newer | Latest | Older

Car Workshop Manuals & Books, Auto, Truck, Motorcycle, Tractor, Outboard

Car Workshop Manuals & Books, Auto, Truck, Motorcycle, Tractor, Outboard

Steel Mesh Sheets & Fence Panels - Blacktown NSW

[Quicksales is an Australian auction website which offers no listing fees]

Web Design - Northern Beaches