next up previous contents
Next: Properties Up: FFish Script Objects Reference Previous: save   Contents

Mail Object

Description

Handles a mail using the MIME (Multipurpose Internet Mail Extensions) protocol.

available: SWFKit, SWFKit Pro


Syntax

new Mail


Parameters

None


Returns

Returns a new instance of the mail object. If failed, returns null.


Remarks

Using this object to read or write emails that sent or received via Internet. An Email can be viewed as having an envelope and contents. The envelope contains information about the email such as the sender, the recipients, the send time, etc. The contents compose the object to deliver to the recipients. The Mail Object supports multipart contents such as attachments and HTML contents.

To write a new email, filling the envelope first. The Mail Object provides some properties to setup the envelope. The following table describes the properties.

Property Description
from Identifies the sender of the email
replyTo Specifies the mailbox to which responses are to be sent
to Identifies the primary recipients of the email.
subject Specifies the subject of the email.
cc Identifies the secondary (informational) recipients of the email
bcc Identifies the additional recipients of the email.
date Specifies the send date.
priority Specifies the priority of the email.


Example

mail = new Mail;

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;

mail.text = "test!";

mail.save("c:\\test.eml");

After filling the envelope, adding contents to the email.

Using the save method to store the email to the disk. Using the SendMail object to send it.

You can also use the Mail object to read an email. For example:

mail = new Mail();
mail.load("c:\\test.eml");
trace("From: " + mail.from);
trace("To: " + mail.to);
trace("Subject: " + mail.subject);
trace("Date: " + mail.date);
trace(mail.text);
trace("htmlitems: " + mail.htmlItemCount);
for (i = 0; i < mail.htmlItemCount; i++)
{
    trace("htmlitems " + i + ": " + mail.getHtmlItemName(i)
        + "\tCID: " + mail.getHtmlItemID(i));
    mail.saveHtmlItem(i, "c:\\" + mail.getHtmlItemName(i));
}

trace("attachments: " + mail.attachmentCount);

for (i = 0; i < mail.attachmentCount; i++)
{
    trace("attachments " + i + ": " + mail.getAttachmentName(i));
    mail.saveAttachment(i, "c:\\" + mail.getAttachmentName(i));
}




Subsections
next up previous contents
Next: Properties Up: FFish Script Objects Reference Previous: save   Contents
Copyright ©2000-2007 Shanghai TopCMM Software Technologies. All Rights Reserved.