home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Mail / appnmail-1.8-Solaris / mailapp-utilities / sendmail-addheadsig < prev    next >
Encoding:
Text File  |  1996-11-24  |  1.7 KB  |  58 lines

  1. #!/bin/sh
  2. ###############################################################################
  3. #
  4. # File:         sendmail-addheadsig
  5. # Description:  A sendmail filter for with Mail.app
  6. # Author:       Carl Edman
  7. # Created:      Thu Aug 19 12:08:55 1993
  8. # Modified:     Fri May 27 16:51:12 1994 (Carl Edman) cedman@capitalist.princeton.edu
  9. # Language:     Bourne shell
  10. # Package:      N/A
  11. # Status:       Experimental (but distribute anyway)
  12. #
  13. # (C) Copyright 1993, but otherwise this file is perfect freeware.
  14. #
  15. ###############################################################################
  16. mkdir /tmp/maildir$$
  17. cd /tmp/maildir$$
  18. attach=`{ cat - ; echo ; } | sed -n '1,/^$/ !w content
  19. /^$/,$ !w header
  20. s/^Next-Attachment: \([^,]*\),.*$/\1/p;'`
  21.  
  22. if test -z ""$attach
  23. then
  24.   if test -r ${HOME}/.signature
  25.   then
  26.      echo "--" >>content
  27.      cat ${HOME}/.signature >>content
  28.   fi
  29. else
  30.   if test -d ${HOME}/.signature.rtfd -o -r ${HOME}/.signature.rtf
  31.   then
  32.     mkdir sub
  33.     /NextApps/Mail.app/decode <content | /usr/ucb/uncompress -f | (cd sub; /NextApps/Mail.app/safetar xf -)
  34.     /bin/rm -f content
  35.     if test -d ${HOME}/.signature.rtfd
  36.     then
  37.       cp -rp ${HOME}/.signature.rtfd/* sub
  38.       mv sub/TXT.rtf sub/index.rtf .
  39.     else
  40.       cp ${HOME}/.signature.rtf ./TXT.rtf
  41.       mv sub/index.rtf .
  42.     fi
  43.     sed '$ s/} *$//' < index.rtf >sub/index.rtf
  44.     sed '1 s/^ *{//; s/{\\NeXTGraphic\([0-9]*\) \(.*\) \\width[0-9]* \\height[0-9]*$/{{\\attachment218\1 \2/;' <TXT.rtf | tr -d '\254' >>sub/index.rtf
  45.     (cd sub; /NextApps/Mail.app/safetar cf - .) | /usr/ucb/compress -f | /NextApps/Mail.app/encode $attach >content
  46.   fi
  47. fi
  48.  
  49. {
  50. cat header
  51. if test -r ${HOME}/.add-header; then cat ${HOME}/.add-header; fi
  52. echo
  53. cat content
  54. }| /usr/lib/sendmail "$@"
  55. cd /tmp
  56. /bin/rm -rf /tmp/maildir$$
  57.  
  58.