Chapter 3 DynaScript Predefined Objects


attachment properties

The attachment object has these properties:

mimeType property

Syntax

attachment.mimeType 

Attributes

This property is read-only.

Description

The MIME type of the attachment, for example "image/gif".

Return

String.

Example

This example retrieves a mail piece with a subject heading of "The attachment object" and displays the attachment name and MIME type.

<!--SCRIPT
mlist = new MailList ("mail.sybase.com", "elmo", "dynamo", "elmo@mail.sybase.com");
for (i in mlist) {
inPiece=mlist[i];
if (inPiece.subject == "The attachment object") {
inPiece.Retrieve();
document.WriteLn( "body: " + inPiece.body );
document.WriteLn( "sender: " + inPiece.sender );
document.WriteLn( "attachment name: " + inPiece.attachments[0].name);
document.WriteLn( "attachment Mime type: " + inPiece.attachments[0].mimeType);
}
}
mlist.Disconnect();
-->

name property

Syntax

attachment.name 

Attributes

This property is read-only.

Description

The name or description of the attachment, if present. This is extracted from MIME headers.

Return

String.

Example

This example uses the name property to save the file with the same name as the attached file.

<!--SCRIPT 
mlist = new MailList ("mail.sybase.com", "elmo", "dynamo", "elmo@mail.sybase.com");
mlistitem = mlist[12];
mlistitem.Retrieve();
document.WriteLn( "subject: " + mlistitem.subject );
document.WriteLn( "size: " + mlistitem.size );
document.WriteLn( "body: " + mlistitem.body );
document.WriteLn( "sender: " + mlistitem.sender );

for( i in mlistitem.attachments ) {
attach = mlistitem.attachments[i];
filesave = attach.SaveAsFile( "g:\\temp\\Dynamo\\" + attach.name );
}
if (filesave) {
document.WriteLn("The file has been saved.");
}
mlist.Disconnect();
-->

 


Copyright © 1999 Sybase, Inc. All rights reserved.