Resend archived mail

mikea mikea at mikea.ath.cx
Tue May 16 18:09:01 IST 2006


On Tue, May 16, 2006 at 11:26:34AM -0500, mikea wrote:
> On Tue, May 16, 2006 at 10:48:25AM -0500, John Schmerold wrote:
> > We had a sad story this morning. Long story short, I need to resend all 
> > archived emails addressed to one domain and archived. We are using 
> > Sendmail. If memory serves all we need to do is copy the archived 
> > message into mqueue like so:
> > cp -p 
> > /var/spool/MailScanner/quarantine/20051101/20051111/?fjABMN7KU009599   
> > /var/spool/mqueue
> > 
> > It's been 15 minutes or so & the emails have not budged from mqueue:
> > [root at mx1 root]# ls -al 
> > /var/spool/MailScanner/quarantine/20051101/20060516/?fk4GF081P020699
> > -rw-rw----    1 root     root         1085 May 16 10:00 
> > /var/spool/MailScanner/quarantine/20051101/20060516/dfk4GF081P020699
> > -rw-rw----    1 root     root         3143 May 16 10:00 
> > /var/spool/MailScanner/quarantine/20051101/20060516/qfk4GF081P020699
> > [root at mx1 root]# ls -al /var/spool/mqueue/?fk4GF081P020699
> > -rw-rw----    1 root     root         1085 May 16 10:00 
> > /var/spool/mqueue/dfk4GF081P020699
> > -rw-rw----    1 root     root         3143 May 16 10:00 
> > /var/spool/mqueue/qfk4GF081P020699
> > 
> > 
> > Two questions:
> > 1. What am I missing?
> > 
> > 2. Does any dear soul have a script they'd care to share with the group 
> > to re-deliver all emails sent to example.com ?
> >        Perhaps something as simple as:
> >            dosomething $(grep -ril "@katy.com" 
> > /var/spool/MailScanner/quarantine/20051101/20060516/qfk4GF081P020699 )
> 
> For the first, some variation of "sendmail -q" should suffice. You want 
> sendmail to run the queue, and that command causes a queue run to happen. 
> Or have you tried that already? 
> 
> I'll defer to others on #2; they'll have some incredibly-obvious-in-
> hindsight solution, where I'll have a Tingueley-cum-Goldberg kludge.
 
This from the sendmail help may help, too: 

       -q[!]R substr
              Limit  processed jobs to those containing substr as
              a substring of one of the recipients or not when  !
              is specified.

       -q[!]S substr
              Limit  processed jobs to those containing substr as
              a substring of the sender or not when !  is  speci-
              fied.

I use "sudo sendmail -v -bp -OQueueDirectory=/var/spool/mqueue.in" to 
list the contents of the inbound queue. -OQueueDirectory=<foo> sets 
directory you want to use as your mail queue for that instance of 
sendmail. 

You could use 

"sendmail -q -qRexample.com \
-OQueueDirectory=/var/spool/MailScanner/quarantine/20051101/20060516/qfk4GF081P020699"

to run the queue for all the mails to example.com stuck in that directory. 

If you wanted to get fancier and were using ksh or some other non-csh shell
then something like

#	
for i in `ls <suitable stuff>`
do
    sendmail -q -qRexample.com -OQueueDirectory=$i
    done
#

might go a long way towards getting that mail out. 

Or, on the gripping hand, it might not. 

-- 
Mike Andrews, W5EGO
mikea at mikea.ath.cx
Tired old sysadmin 


More information about the MailScanner mailing list