mailmessage

Top  Previous  Next

o=new("mailmessage",to$,from$,subject$,body$,attach$,cc$,bcc$)

 

A mail message object represents an email message, including all its header and message content, as well as all its attachments.  Attachments are found in the attachments property, which is an object collection object holding mailattachment objects.  When creating a new mail message, all parameters are optional, but are positional.  Properties can also be set once the object is created.

 

Mail message objects are applicable to both the mailreader and mailsender objects.  A mailreader object creates message objects when it retrieves mail from a mail server.  The mailsender object can send messages provided as mailmessage objects, so a new mailmessage can be created and populated, then sent, as an alternative technique to the email() or deliver() functions.

 

Properties

to

The "to" property is a memcollection object, which can be read using memcollection methods, or added to with the addto() method.  Each item in the collection is either a simple address, or a "name" <address> string.

cc

The "cc" property is similar to the "to" property, but stores carbon copy addresses.

bcc

The "bcc" property is similar to the "cc" property, but stores blind carbon copy addresses.

from$

Stores the From address, or "Name" <address> string.

replyto$

Stores a "Reply-to" value, similar to a From address.

date$

Stores a UTC date string in Internet standard format.

datetime

Stores a julian date/time value derived from the date$ property.

subject$

Stores the message subject.

body$

Stores the message text or html content.

bodytype$

Stores the MIME type of the message body.

bodycharset$

Stores the character set of the message body.

retrec$

Stores a return receipt email address.

importance$

Stores the "importance" header information.

otherheaders

Stores additional headers.  Use the addheader() method to add custom h eaders before sending a mailmessage.

attachments

An objcollection object that stores mailattachment objects associated with the message.

popid$

When a mail message is read from a POP server, this is the unique ID assigned to the message by the mail server.  This ID is used when the mailreader retrieves a message.

popsize

The message size reported by the POP mail server.

 

 

Methods

createreply([replyhdr$])

This method returns a new mailmessage object, created from the current object, with the To address being the Reply-to or From address of the current message.  The message body is copied into the new message, with the specified replyhdr$ value above it.  If not supplied, a From, Date, and Subject reply header is generated.  Also, the subject line in the new message is prefixed with "Re:".

createreplyall([replyhdr$])

Like the createreply() method, except the reply is generated with all To and CC addresses copied to the new message.

createforward()

Like the createreply() method, but no To or CC addresses are generated.

addto(addr$[,name$])

Adds the address and optional name to the the To collection.

addcc(addr$[,name$])

Adds the address and optional name to the the Cc collection.

addbcc(addr$[,name$])

Adds the address and optional name to the the Bcc collection.

addattachment(filename$)

Adds the file specified to the attachments collection.

addheader(line$)

Adds a header line, which must be "Header: Value" syntax.

addheader(name$,value$)

Adds a header line with the header name and value property formatted.

setfrom(addr$[,name$])

Sets the from address to the address and optional name.

setreplyto(addr$[,name$)

Sets a reply-to address.

setretrec(addr$[,name$])

Sets a return receipt request address.

getheader$(name$)

Returns a header value of the specified name, or null if the name does not exist.  The name is case-insensitive.  The to, cc, and bcc headers return comma-separated addresses.

parsefile(filename$)

Parses an email content file, which must be in RFC822 format, as is typically received by a mail client from a mail server.  Such files are often stored in archive libraries with a "eml" file type.  The current object instance data is populated from the file data.  Returns 1 if successful, 0 otherwise.

parsesubid(library$,doctype$,docid$,subid$)

Parses email content from a stored archive record, which must be in RFC822 format, typically with a type of "eml".  The current object instance data is populated from the file data.  Returns 1 if successful, 0 otherwise.