home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / mmailp.idb / usr / lib / Zmail / bin / extcompose.z / extcompose
Encoding:
Text File  |  1997-01-22  |  3.4 KB  |  104 lines

  1. #!/bin/csh -fb
  2. # (The "-fb" might need to be changed to "-f" on some systems)
  3. #
  4.  
  5. if ($#argv < 1) then
  6.     echo "Usage:  extcompose output-file-name"
  7.     exit 1
  8. endif
  9. set OUTFNAME=$1
  10.  
  11. chooseaccesstype:
  12. echo ""
  13. echo "Where is the external data that you want this mail message to reference?"
  14. echo "    1 -- In a local file"
  15. echo "    2 -- In an AFS file"
  16. echo "    3 -- In an anonymous FTP directory on the Internet"
  17. echo "    4 -- In an Internet FTP directory that requires a valid login"
  18. echo "    5 -- Under the control of a mail server that will send the data on request"
  19. echo ""
  20. echo -n "Please enter a number from 1 to 5: "
  21. set ans=$<
  22. if ($ans == 1)  then
  23.     set accesstype=local-file
  24. else if ($ans == 2) then
  25.     set accesstype=afs
  26. else if ($ans == 3) then
  27.     set accesstype=anon-ftp
  28. else if ($ans == 4) then
  29.     set accesstype=ftp
  30. else if ($ans == 5) then
  31.     set accesstype=mail-server
  32. else
  33.     echo "That is NOT one of your choices."
  34.     goto chooseaccesstype
  35. endif
  36. if ($accesstype == "ftp" || $accesstype == "anon-ftp") then
  37.     echo -n "Enter the full Internet domain name of the FTP site: "
  38.     set site=$<
  39.     echo -n "Enter the name of the directory containing the file (RETURN for top-level): "
  40.     set directory=$<
  41.     echo -n "Enter the name of the file itself: "
  42.     set name = $<
  43.     echo -n "Enter the transfer mode (type 'image' for binary data, RETURN otherwise): "
  44.     set mode = $<
  45.     if ($mode == "") set mode=ascii
  46.     echo "Content-type: message/external-body; access-type=$accesstype; name="\"$name\"\; > $OUTFNAME
  47.     echo -n "    site="\"$site\" >> $OUTFNAME
  48.     if ($directory != "") echo -n "; directory="\"$directory\">> $OUTFNAME
  49.     if ($mode != "") echo -n "; mode="\"$mode\">> $OUTFNAME
  50.     echo "">> $OUTFNAME
  51. else if ($accesstype == "local-file" || $accesstype == "afs") then
  52. fname:
  53.     echo -n "Enter the full path name for the file: "
  54.     set name = $<
  55.     if (! -e $name) then
  56.     echo "The file $name does not seem to exist."
  57.     goto fname
  58.     endif
  59.     echo "Content-type: message/external-body; access-type=$accesstype; name="\"$name\"> $OUTFNAME
  60. else if ($accesstype == "mail-server") then
  61.     echo -n "Enter the full email address for the mailserver: "
  62.     set server=$<
  63.     echo "Content-type: message/external-body; access-type=$accesstype; server="\"$server\"> $OUTFNAME
  64. else
  65.     echo accesstype $accesstype not yet implemented
  66.     goto chooseaccesstype
  67. endif
  68.  
  69. echo -n "Please enter the MIME content-type for the externally referenced data: "
  70. set ctype = $<
  71. getcenc:
  72. echo "Is this data already encoded for email transport?"
  73. echo "  1 -- No, it is not encoded"
  74. echo "  2 -- Yes, it is encoded in base64"
  75. echo "  3 -- Yes, it is encoded in quoted-printable"
  76. echo "  4 -- Yes, it is encoded using uuencode"
  77. set encode=$<
  78. switch ("$encode")
  79.     case 1:
  80.         set cenc=""
  81.         breaksw
  82.     case 2:
  83.         set cenc="base64"
  84.         breaksw
  85.     case 3:
  86.         set cenc="quoted-printable"
  87.         breaksw
  88.     case 4:
  89.         set cenc="x-uue"
  90.         breaksw
  91.     default:
  92.         echo "That is not one of your choices."
  93.         goto getcenc
  94. endsw
  95. echo "" >> $OUTFNAME
  96. echo "Content-type: " $ctype >> $OUTFNAME
  97. if ($cenc != "") echo "Content-transfer-encoding: " $cenc >> $OUTFNAME
  98. echo "" >> $OUTFNAME
  99. if ($accesstype == "mail-server") then
  100.     echo "Please enter all the data to be sent to the mailserver in the message body, "
  101.     echo "ending with ^D or your usual end-of-data character:"
  102.     cat >> $OUTFNAME
  103. endif
  104.