LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-01-2009, 02:26 AM   #1
EanB
LQ Newbie
 
Registered: Oct 2009
Posts: 4

Rep: Reputation: 0
Need to redirect sendmail mail already in mailq


Hi,
[apologies not overly sendmail literate]We were redirecting mail for certain users to a hosted mail provided (via the alias file).

This provider has changed their servers / settings etc, so we have a pile of mail in the mailq already that I need to get to the individuals concerned.

I tried removing the aliases, but the messages are obviously already trying to get to the old address.

Is there some way I can force the mail (formail??) in the queue to go to another email address (there is only 4 users involved but they are Group Directors, so could run something on an address by address basis if possible).

Thanks,
Ean
 
Old 10-01-2009, 03:30 AM   #2
EanB
LQ Newbie
 
Registered: Oct 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Ok,

I think if I got to the /var/spool/mqueue directory and run

procmail –Y -d email@address < message-id that this will forward an idividual message to an email address?

I can run grep "old@address" * in mqueue directory and it will give me all the dfn.... and qfn.... file (i assume the q one is the actual message queue id)

Can anyone give me the command / script to be able to list those files for "old@address" and pipe / pass them to the procmail command (or is there another way to do this??)
 
Old 10-01-2009, 03:41 AM   #3
EanB
LQ Newbie
 
Registered: Oct 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Ok, think I've worked it out..

grep -l "old@address" * |procmail -Y -d new@newaddress
 
Old 10-01-2009, 05:12 AM   #4
EanB
LQ Newbie
 
Registered: Oct 2009
Posts: 4

Original Poster
Rep: Reputation: 0
No that didn't work, the messages come through as blank or not decoded??
 
Old 10-01-2009, 07:02 AM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,294

Rep: Reputation: 1698Reputation: 1698Reputation: 1698Reputation: 1698Reputation: 1698Reputation: 1698Reputation: 1698Reputation: 1698Reputation: 1698Reputation: 1698Reputation: 1698
Hi,

I think that the only way to do what you want, is to write a script to parse all qf* files in /var/spoo/mqueue and replace old@address with new@newaddress (actually you need to do the substitution only for the line that starts with RPFD, but it's more easier to do it for all occurrences of old@address).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sendmail, how to redirect mail to a new drive sencha Linux - Server 2 10-16-2008 09:44 AM
Sendmail -> Mailq error. egingell Linux - Networking 3 05-10-2005 01:20 AM
sendmail - mailq pk21 Linux - General 4 10-05-2003 01:05 AM
Sendmail 8.12.3 Mailq juser Linux - Newbie 0 05-22-2003 03:02 PM
SENDMAIL: I can receive mail but timeouts when trying to send. mailq show deferred. adamrau Linux - Software 0 10-01-2001 07:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration