next up previous contents
Next: SendMail Object Up: Methods Previous: saveHtmlItem   Contents

addHtmlItem

Description

Adds a HTML item from disk file.


Syntax

mail.addHtmlItem(filename, cid)


Parameters

filename
Specifies full path and name of the file to save.
cid
Specifies the Content-ID of the HTML item.


Returns

Nothing


Example

//The example embedded a flash movie in an email.
//read the html file
var stream = new FileStream("c:\\demo\\clock.html", "r");
var str = "";
while (stream.pos < stream.length)
{
    var s = stream.readLine();
    str += s;
    str += "\r\n";
}

stream.close();
var mail = new Mail;
//make the envelope
mail.from = "abc@host.com";
mail.replyTo = "abc@host.com";
mail.to = "someone@server.com";
mail.subject = "A test";
mail.cc = "someoneelse@anotherserver.com";
mail.bcc = "anotherone@bccserver.com";
mail.date = Date();
mail.priority = 3;

//make the html
var re = new RegExp("clock.swf", "gi");
mail.html = str.replace(re, "cid:12345");
//load the flash movie
mail.addHtmlItem("c:\\demo\\clock.swf", "12345");
//save the mail. It can be opened in the Microsoft Outlook
Express
mail.save("c:\\demo\\demo.eml");




Copyright ©2000-2007 Shanghai TopCMM Software Technologies. All Rights Reserved.