LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Need to redirect sendmail mail already in mailq (https://www.linuxquestions.org/questions/linux-server-73/need-to-redirect-sendmail-mail-already-in-mailq-758849/)

EanB 10-01-2009 01:26 AM

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

EanB 10-01-2009 02:30 AM

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??)

EanB 10-01-2009 02:41 AM

Ok, think I've worked it out..

grep -l "old@address" * |procmail -Y -d new@newaddress

EanB 10-01-2009 04:12 AM

No that didn't work, the messages come through as blank or not decoded??

bathory 10-01-2009 06:02 AM

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).


All times are GMT -5. The time now is 07:38 PM.