CDS184

Attach file to email

Last Revised: 02/12/16

The routine is used to attach a file to an email that was initiated using CDS084.  The file can be of any size or type.

Calling Format:

CALL "CDS184", ERR=NO_OPEN, Y$, Y6$, FILNAM$ {, TXTNAM$ }

CDS184
NO_OPEN Line to branch to if CDS184 cannot open FILNAM$.  Some possible errors include: error 0 if file is locked by another user, error 12 if file does not exist, or error 18 if user does not have permissions to open file. The user will be prompted with the specific error unless running as a background task, and the program is dated 02/12/16 or later.
Y$ Task Control Variable from Menu Processor
Y6$ Printer Control Variable from CDS084
FILNAM$ The path to the file name to be attached.
TXTNAM$ The name for the file that the email client will see when they go to save the attached file.  This name cannot contain / or \ characters, nor a DOS drive letter.  This field is optional.  If not passed, or passed as null, then the base file name from FILNAM$ will be used.

You may call CDS184 multiple times to attach multiple files to the same email.

For large files, CDS184 will display a progress message as the file is processed.

CDS184 looks at the extension of FILNAM$ to determine the MIME Content Type which describes the type of attachment.  The Content Types supported are shown below.

File Name Extension MIME Content Type
pdf application/pdf
json application/json
js application/javascript
htm, html, xhtml, xml application/xhtml+xml
dtd application/xml-dtd
zip application/zip
gz application/x-gzip
css text/css
txt text/plain
csv text/tab-separated-values
vcf text/x-vcard
bmp image/bmp
gif image/gif
jpg, jpe, jpeg image/jpeg
png image/png
tif, tiff image/tiff
ico image/x-icon
*any other* application/octet-stream