fwd.sh (870B)
1 #!/bin/bash 2 3 usage() { 4 printf "usage: %s [-h] mailid\n" "$(basename "$1")" 5 } 6 7 while getopts "hal" opt; 8 do 9 case $opt in 10 *) 11 usage $0 12 exit 1 13 ;; 14 esac 15 done 16 shift `expr $OPTIND - 1` 17 if [ "$1" = "--" ]; 18 then 19 shift 1 20 fi 21 22 if [ $# -lt 1 ]; 23 then 24 usage $0 25 exit 1 26 fi 27 28 ids="$@" 29 if [ -z "$ids" ]; 30 then 31 usage $0 32 exit 1 33 fi 34 35 nsubject="Fwd: $(rpview -ve Subject -- "$ids")" 36 37 printf "Date: %s 38 From: %s 39 Subject: %s 40 To: 41 Cc: 42 Bcc: 43 User-Agent: rohrpost 44 MIME-Version: 1.0 45 Content-Type: text/plain; charset=utf-8 46 Content-Transfer-Encoding: 8bit" \ 47 "$(LC_ALL=C date "+%a, %d %b %Y %T %z")" \ 48 "$(rpcfg -v defaultfrom)" \ 49 "${nsubject}" 50 [ -e "$HOME/.mailheaders" ] && cat "$HOME/.mailheaders" 51 printf "\n" 52 53 # Consider checking for multiple messages and add them as eml or inline. 54 rpview -nb -- "$ids" | sed 's/^/> /' 55 printf "\n" 56 57 [ -e "$HOME/.signature" ] && cat "$HOME/.signature" 58 59