home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / metamail / bin / extcompose < prev    next >
Encoding:
Text File  |  1993-02-09  |  3.3 KB  |  102 lines

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