[exim] Re: How can I force redelivery of saved message?

トップ ページ
このメッセージを削除
このメッセージに返信
著者: graeme vetterlein
日付:  
To: exim-users
題目: [exim] Re: How can I force redelivery of saved message?
Amazingly , a google search brought me to an email in a group I
subscribe to ...and it was recent (but I still missed it :-( )


I changed my /etc/mailname to let's say "badname" and a whole bunch of
mail got sent to users@badname  and the report on th failure to
postmaster@badname   ...I never saw any ... so time has passed but as it
happens I have a log ...


### transport/25_exim4-config_gpv_local_copy_outgoing
#################################

# This transport is used to make archival copies of all outgoing mail
# Other config in /etc/exim4/systemfilter.txt and
/etc/exim4/systemfilter.txt
#
local_copy_outgoing:
    driver = appendfile
    delivery_date_add

     ....


So I had a local copy of "lost email" ..so similar to OP.. I needed
creating this:


# !/bin/bash -u

# $1 is the filename containing original email (won't work with stdin) ,
it will be resent to the address we match below
#
# I use: X-Original-To: and From: as the key headers, you may want to
use different ones
#
#
genheader() {
    awk '
         /^X-Original-To:.*/ { gsub("^.*: ", ""); gsub(",.*", "");
print "RCPT TO: " $0 }
         /^From:/            { gsub("^.*: ", ""); print "MAIL FROM: " $0 }
    ' "${@:--}"
}

HEADERS=$(genheader ${1} | sort)  # "MAIL FROM" sorts before "RCPT TO"  :-)

FULLHEAD="${HEADERS}
DATA"

echo "Resending: ${1} " ${HEADERS} >&2

echo "$FULLHEAD"  | cat - $1 <(echo ".") | sendmail -bS
#echo "$FULLHEAD"  | cat - $1 <(echo ".") > /tmp/mail-with-header



And I used it like this:


find ${dir} -type f -mtime -1  | xargs grep -l "X-Original-To: graeme" |
xargs -L 1 bash ./resend-email.sh


(well , sadly I need -mtime 5 or 6 :-o )


It's not very clean ... it just drops any other addresses after the 1st
comma  and that sort is pure fluke  ... but it does the job , for me at
least YMMV.





--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/