You can use Send Distribution command (SNDDST) to send e-mail with an attached file or document.
When sending e-mail on the iSeries™ server 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 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)
With the iSeries server playing a larger role in the Internet, a method is needed to send information easily from the i5/OS™ to e-mail clients.
Assuming that the spooled file is already created, and the physical file and folder already exist, you must convert the file into a sendable format. The conversions are done by using iSeries commands, as shown in the following example:
Move the spooled file to a database physical file:
CPYSPLF FILE(splfile) TOFILE(dbfile) JOB(job3/job2/job1) SPLNBR(splnbr) TOMBR(mbr)
Move the physical database file to a folder:
CPYTOPCD FROMFILE(lib/dbfile) TOFLR(folder) FROMMBR(mbr) REPLACE(*YES)
Send the document:
SNDDST TYPE(*DOC) TOUSRID(user address) DSTD(MAIL) DOC(mbr) FLR(folder)