wiki:Documentation/ARexxAPI/WRITEATTACH

Version 5 (modified by damato, 8 months ago) (diff)

--

Languages:

WRITEATTACH

NAME
WriteAttach -- Attach a file to a new message.
TEMPLATE
FILE/A,DESC,ENCMODE,CTYPE
FUNCTION
Attaches a file to a new message.
INPUTS
FILE/A - filename to attach, with path
DESC - optional, string with a description for the file (V1.3)
ENCMODE - optional, encoding type for the file; may be either "uu" or "b64" (V1.3)
CTYPE - optional, content type of the file (V1.3)
RETURNS
RC is set to 10 if no Write window was previously specified as "active" with MAILWRITE.
NOTES
By default, binary files are encoded as Base64 (MIME), whereas text files are UUencoded.

The default content type is taken after scanning the built-in list of MIME types and then looking at the MIME types defined in the user configuration. For instance, if the user has defined "application/pgs" as MIME type for files using the ".pgs" extension, all files attached bearing this extension will default to "application/pgs" unless CTYPE overrides this. If no suitable MIME type is found and no content type has been specified, YAM will fallback to "application/octet-stream".

EXAMPLE
/* Set the active Write window */
MAILWRITE WINDOW 0

/* Attach a file */
WRITEATTACH 'Docs:Mag.pgs' ENCMODE 'b64' CTYPE 'application/pgs'
BUGS
No error is returned if the specified file was found but couldn't be opened.
SEE ALSO
MAILWRITE