Login   /   Register

Sending an HTML email from a pre-made file

Rate this article
     1 votes, average: 3 out of 51 votes, average: 3 out of 51 votes, average: 3 out of 51 votes, average: 3 out of 51 votes, average: 3 out of 5
Loading ... Loading ...
April 11th, 2008 by Yaron Assa

This QTip is another variation of Sending an HTML email.

Windows 2000 and Windows XP use CDO messaging as a replacement for CDONTS. Sending email with CDO is a simple task.  First we create a reference to the CDO component:

Set objMessage = CreateObject("CDO.Message") 

Then fill-in Sender, Subject and Recipient (To) fields of the headers and the body text which can be either plain text or HTML. You can also add a file attachment. You then use the Send method to send the email.

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example CDO Message"
objMessage.From = "me@my.com"
objMessage.To = "test@test.com"
 
'The line below shows how to send a webpage from a file on your machine
objMessage.CreateMHTMLBody "file://c|/temp/test.htm"
 
objMessage.Bcc = "you@your.com"
objMessage.Cc = "you2@your.com"
objMessage.Send

Posted in CDO Component

One Response to “Sending an HTML email from a pre-made file”

  1. tcwmj Says:

    [-]

    when I run to the last “send” command, system told me that “sendUsage is invaild”, what’s the matter?

Leave a Reply

You must be logged in to post a comment.

This article was viewed 672 times