[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[msmtp-users] Update the date in the mail file



Hi,

msmtpqueue is great to collect a couple of mails and send them out in one batch. The only problem is that the mail files will contain the date when the email was constructed and not when they are sent. This causes problems with people receiving emails that are 24hrs or older and consequently don't show up at the top of their pile.

The fix is to add this to the msmtp-runqueue.sh file:

# update all mail files
for MAILFILE in *.mail; do
    TMPFILE=$(mktemp)
    echo "*** Updating date in $MAILFILE via $TMPFILE..."
    sed -e "0,/Date:.*$/s//Date: $(date)/" $MAILFILE > $TMPFILE  && mv $TMPFILE $MAILFILE
done


I was thinking to enable this through a passed parameter but then on the other hand, why would you want to send emails with an old date.

 K.