Attaching files

 

You can send e-mail with an attached file or document by using the Send Distribution (SNDDST) command.

When sending e-mail using the SNDDST command, you might want to send a file or document with the e-mail. SNDDST is only capable of sending a single document or file at a time. If you would like to send multiple attachments, send MIME mail with the Send MIME Mail (QtmmSendMail) API.

To attach and send a document with your e-mail, in the character-based interface, type:

SNDDST TYPE(*DOC) DSTD(your description) TOUSRID(anyuser) DOC(yourdoc) FLR(yourfolder)

To attach and send a file with your e-mail, in the character-based interface, type:

SNDDST TYPE(*FILE) DSTD(description) TOUSRID(any user) 
MSG(message optional) DOCFILE(youlib/yourfile) DOCMBR(yourmbr)

If you receive error messages, you might be attempting to send a file or document that is in a format that is not compatible with the Send Distribution (SNDDST) command. You can use the i5/OS® CL CPY commands to convert the file to a file or document that is compatible with the SNDDST command.

 

Converting file types to send with SNDDST

Assuming that the spooled file is already created, and the physical file and folder already exist, convert the file into a sendable format. The conversions are done by using i5/OS CL commands, as shown in the following example:

  1. Move the spooled file to a database physical file:

    CPYSPLF   FILE(splfile)  TOFILE(dbfile)  JOB(job3/job2/job1) SPLNBR(splnbr) TOMBR(mbr)

  2. Move the physical database file to a folder:

    CPYTOPCD   FROMFILE(lib/dbfile)  TOFLR(folder) FROMMBR(mbr)  REPLACE(*YES)

  3. Send the document:

    SNDDST   TYPE(*DOC)  TOUSRID(user address) DSTD(MAIL) DOC(mbr)  FLR(folder)

 

Parent topic:

Using Systems Network Architecture distribution services to send e-mail
Related reference
QtmmSendMail API