Submitting files with a shell script

You can create a shell script (named sendfile for this example) with a simpler command syntax because the pdpr command is included in the shell script.

Create a file that contains the pdpr command and all its attributes. Create a shell script and put it in a directory on the system where you have installed the pdpr command.

The file should look similar to this:

		# Sample Attribute File for InfoPrint Manager Email
      # using a script to submit
      # sendemail $1 $2
      # $1 is required as the name of the file to send.
      # $2 is optional as the recipient of the email.
      #
      #! /usr/bin/ksh
      if [[ -a $1 && -n $1] ]
      then
      if [ $2 ]
      then
      WHOTO=$2
      else 
      WHOTO="johndoe@us.name.com"
      fi
      /usr/lpp/pd/bin/pdpr -p email1-ld \
      -r brief \
      -x email-to-address=$WHOTO \
      -x email-from-address=root@serv.us.name.com \
      -x "subject-text='Your requested Email file'" \
      -x document-type=printable $1 \
      -x document-type=email-body /email_script/body.txt \
      -x document-type=email-signature /email_script/sig.txt
      else
		echo " sendfile: could not locate file [$1]"
      fi

On the command line, this shell script uses this syntax:

sendfile outputfilename [destination]
where outputfilename specifies the file that you are sending (sample.pdf) and destination is the e-mail address (johndoe) to which you are sending the file.

This script sends an e-mail to either the destination value that you specify as the second argument on the command line, or to 'johndoe' Internet ID, if you use the default. The script uses a logical destination (printer) named email1-ld on your InfoPrint server.

The convention us.name.com indicates a typical Internet address for a business.