3 # Quick hack for fetchmail to locally spool messages.
6 # fetchmail --mda "fetchspool -t %T %F"
10 # Robert de Bath <robert@mayday.cix.co.uk>
11 # updated by william boughton <bill@xencat.demon.co.uk>
12 # 4th/10/1998 and tested
14 # William Boughton comments:
15 # Still has some potential problems, with using inline from address.
16 # The use of _ is bad because fetchmails uses this if it notices
19 # Changed to using 3 _@@s to delimit the message, i hope this is ok.
20 # Whilst i have tested and used this script, with my demon account and
21 # SDPS, it may still have serious problems, that i've not noticed etc.
36 cat - > $MAILSPOOL/tmp.$$ || exit 1
37 mv $MAILSPOOL/tmp.$$ "$MAILSPOOL/msg.`date +%j%H%M%S`$$.to.${ADDR}_@@${FROM}" || exit 1
41 for i in $MAILSPOOL/msg.*.to.*
43 [ -f "$i" ] || continue
44 # TO="`echo \"$i\" | sed 's/^msg.[^.]*.to.//'`"
45 TO=$(basename $i | sed -e 's/^msg.[^.]*.to.//' -e 's/_@@.*$//')
46 FROM=$(basename $i | sed 's/^msg.[^.]*.to.*_@@//')
47 # need the \<\> so for bounces to have a proper from addr
48 echo the to was \<$TO\> and the from \<$FROM\>
49 /usr/lib/sendmail -f \<${FROM}\> -oem "$TO" < "$i" ||
51 echo "Sendmail failed on `basename \"$i\"`"