niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Apps » Qmail
forwarding without changing the header
Post new topic   Reply to topic Page 1 of 1 [12 Posts] View previous topic :: View next topic
Author Message
Kyle Wheeler
*nix forums Guru Wannabe


Joined: 07 Jan 2005
Posts: 208

PostPosted: Fri Jun 23, 2006 9:38 pm    Post subject: Re: forwarding without changing the header Reply with quote

On Thursday, June 22 at 10:39 PM, quoth Vahid Moghaddasi:
Quote:
I am collecting all mail files from many machines into a directory
hierarchy / server1/..../serverx/ then want to inject them into the
queue to be delivered to the off-site company. I know serialmail
may do this but not sure it also complains about "Delivered-To" or
has any sort of log to count the delivered mails.

Is there something wrong (or unusable) about the qmail mails?


No, there is nothing wrong with them, why do you ask?

Erp, I meant to say the qmail logs. Are they not giving you the
information you want, or just too hard to parse?

Quote:
You could use formail to inject things, and generate a log, like
this:

for F in Maildir/cur/* ; do
cat $F | formail -f -b -i Delivered-To \
-l logdir -s qmail-inject you@there.com
done

Thanks for your help, I will try to write something in Perl for
filtering the mail files.

Suit yourself.

I guess I don't have to do that now. Just to see if I understood
this correctly, if I use formail to rename the header to
Old-Delivered-To and reinject the new message into the queue (for
you@there.com), then my original sender "From:" and original
recipient(s) "To:" and "Cc:" are preserved when the mail reaches
mailbox you@there.com. Is that a correct assumption?

That should be what happens, yes (provided you don't have any of the
special environment variables set to make qmail-inject fiddle with the
message). You may also want to add a -fsender@here.com flag to the
qmail-inject call, in case the message bounces.

~Kyle
--
Where justice is denied, where poverty is enforced, where ignorance
prevails, and where any one class is made to feel that society is an
organized conspiracy to oppress, rob and degrade them, neither persons
nor property will be safe.
-- Frederick Douglas
Back to top
Vahid Moghaddasi
*nix forums addict


Joined: 25 Feb 2005
Posts: 96

PostPosted: Fri Jun 23, 2006 2:39 am    Post subject: Re: forwarding without changing the header Reply with quote

On 6/22/06, Kyle Wheeler <kyle-qmail@memoryhole.net> wrote:
Quote:

On Wednesday, June 21 at 09:15 PM, quoth Vahid Moghaddasi:
All of my mail files have "Delivered-To" line in them since they
are from QUEUE_EXTRA option.

Then you've got some more filtering work to do. `man awk` should
be sufficiently instructive.


Is there any other way that you can think of to accomplish this?

"This" being resending mail from a Maildir? Sure, you can write your
own script that will prepare messages and inject them into the queue
with qmail-inject. But that's not going to solve the "problems" you're
having with serialmail, so it's a pointless alternative. The "problem"
you will have will be the same no matter what method of resending them
you use: you need to prepare the messages for sending such that they
do not appear to have already been delivered.

You can use awk for this if you're talented, or you can use the
formail utility (part of the procmail package) as well. For example:

cat message | formail -f -b -i Delivered-To > message.prepared

I did not know about formail, I see that it was installed on my Solaris 10
box by the companion disk.


Quote:
I am collecting all mail files from many machines into a directory
hierarchy / server1/..../serverx/ then want to inject them into the
queue to be delivered to the off-site company. I know serialmail may
do this but not sure it also complains about "Delivered-To" or has
any sort of log to count the delivered mails.

Is there something wrong (or unusable) about the qmail mails?


No, there is nothing wrong with them, why do you ask?

You could use formail to inject things, and generate a log, like this:
Quote:

for F in Maildir/cur/* ; do
cat $F | formail -f -b -i Delivered-To \
-l logdir -s qmail-inject you@there.com
done

Thanks for your help, I will try to write something in Perl for
filtering the mail files.

Suit yourself.

I guess I don't have to do that now.
Just to see if I understood this correctly, if I use formail to rename the
header to Old-Delivered-To and reinject the new message into the queue (for
you@there.com), then my original sender "From:" and original recipient(s)
"To:" and "Cc:" are preserved when the mail reaches mailbox you@there.com.
Is that a correct assumption?
Thank you very much for your help, it has already got me going.
Back to top
Kyle Wheeler
*nix forums Guru Wannabe


Joined: 07 Jan 2005
Posts: 208

PostPosted: Thu Jun 22, 2006 1:59 pm    Post subject: Re: forwarding without changing the header Reply with quote

On Wednesday, June 21 at 09:15 PM, quoth Vahid Moghaddasi:
Quote:
All of my mail files have "Delivered-To" line in them since they
are from QUEUE_EXTRA option.

Then you've got some more filtering work to do. `man awk` should
be sufficiently instructive.


Is there any other way that you can think of to accomplish this?

“This” being resending mail from a Maildir? Sure, you can write your
own script that will prepare messages and inject them into the queue
with qmail-inject. But that’s not going to solve the “problems” you’re
having with serialmail, so it’s a pointless alternative. The “problem”
you will have will be the same no matter what method of resending them
you use: you need to prepare the messages for sending such that they
do not appear to have already been delivered.

You can use awk for this if you’re talented, or you can use the
formail utility (part of the procmail package) as well. For example:

cat message | formail -f -b -i Delivered-To > message.prepared

I’m sure there are other tools that do the same thing; use Google to
find them if you are unsatisfied with the above suggestions.

Quote:
I am collecting all mail files from many machines into a directory
hierarchy / server1/..../serverx/ then want to inject them into the
queue to be delivered to the off-site company. I know serialmail may
do this but not sure it also complains about "Delivered-To" or has
any sort of log to count the delivered mails.

Is there something wrong (or unusable) about the qmail mails?

You could use formail to inject things, and generate a log, like this:

for F in Maildir/cur/* ; do
cat $F | formail -f -b -i Delivered-To \
-l logdir -s qmail-inject you@there.com
done

Quote:
Thanks for your help, I will try to write something in Perl for
filtering the mail files.

Suit yourself.

~Kyle
--
There is no more evil thing in this world than race prejudice . . . It
justifies and holds together more baseness, cruelty, and abomination
than any other sort of error in the world.
-- H. G. Wells
Back to top
Vahid Moghaddasi
*nix forums addict


Joined: 25 Feb 2005
Posts: 96

PostPosted: Thu Jun 22, 2006 1:15 am    Post subject: Re: forwarding without changing the header Reply with quote

On 6/21/06, Charles Cazabon <qmail@discworld.dyndns.org> wrote:

Quote:
Vahid Moghaddasi <vahid.moghaddasi@gmail.com> wrote:

find Maildir/{cur,new}/ -type f \
| while read file ; do
new-inject -f <your_sender_address> <recipient> <"$file"
done

I think new-inject does not like "Delivered-To:" in the header or maybe
some
other problem exist.

It's qmail-local. While delivering the message, it constructs a
Delivered-To:
header field; if an identical header field exists in the message, it means
the
message is looping and qmail-local bounces it.

All of my mail files have "Delivered-To" line in them since they are
from
QUEUE_EXTRA option.

Then you've got some more filtering work to do. `man awk` should be
sufficiently instructive.


Is there any other way that you can think of to accomplish this? I am
collecting all mail files from many machines into a directory hierarchy
/server1/..../serverx/ then want to inject them into the queue to be
delivered to the off-site company. I know serialmail may do this but not
sure it also complains about "Delivered-To" or has any sort of log to count
the delivered mails.
Thanks for your help, I will try to write something in Perl for filtering
the mail files.
Back to top
Charles Cazabon
*nix forums Guru


Joined: 08 Jan 2005
Posts: 805

PostPosted: Wed Jun 21, 2006 2:01 pm    Post subject: Re: forwarding without changing the header Reply with quote

Vahid Moghaddasi <vahid.moghaddasi@gmail.com> wrote:
Quote:

find Maildir/{cur,new}/ -type f \
| while read file ; do
new-inject -f <your_sender_address> <recipient> <"$file"
done

I think new-inject does not like "Delivered-To:" in the header or maybe some
other problem exist.

It's qmail-local. While delivering the message, it constructs a Delivered-To:
header field; if an identical header field exists in the message, it means the
message is looping and qmail-local bounces it.

Quote:
All of my mail files have "Delivered-To" line in them since they are from
QUEUE_EXTRA option.

Then you've got some more filtering work to do. `man awk` should be
sufficiently instructive.

Charles
--
--------------------------------------------------------------------------
Charles Cazabon <qmail@discworld.dyndns.org>
Read http://pyropus.ca/personal/writings/12-steps-to-qmail-list-bliss.html
My services include qmail consulting. See http://pyropus.ca/ for details.
--------------------------------------------------------------------------
Back to top
Vahid Moghaddasi
*nix forums addict


Joined: 25 Feb 2005
Posts: 96

PostPosted: Wed Jun 21, 2006 3:35 am    Post subject: Re: forwarding without changing the header Reply with quote

On 6/20/06, Charles Cazabon <qmail@discworld.dyndns.org> wrote:

Quote:
Vahid Moghaddasi <vahid.moghaddasi@gmail.com> wrote:

A "normal" forwarding instruction won't change the original "sender in
the
header",

I just need the normal forwarding then. Is there an easy way to do this
after the mails are captured in Maildir format? I need to look for mails
that are *not* To or Cc to anyone at "example.com" then forward them to
one
fixed e-mail address and deleting the rest.

Filter the maildir down to just messages that you want to send to a given
address, then do:

find Maildir/{cur,new}/ -type f \
| while read file ; do
new-inject -f <your_sender_address> <recipient> <"$file"
done

You can automate the filtering process with a little scripting glue and
the
mess822 package.


I think new-inject does not like "Delivered-To:" in the header or maybe some
other problem exist. I did the following:
new-inject -f sender @ example.com vahid.moghaddasi @
gmail.com<vahid.moghaddasi@gmail.com><
1150853840.19339.localhost
then I got the following at my gmail.com address:

Hi. This is the qmail-send program at warp.example.com.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

<log @ warp.example.com <log@warp.example.com>>:
This message is looping: it already has my Delivered-To line. (#5.4.6)

--- Below this line is a copy of the message.

All of my mail files have "Delivered-To" line in them since they are from
QUEUE_EXTRA option.

Thanks for your help.
Back to top
Charles Cazabon
*nix forums Guru


Joined: 08 Jan 2005
Posts: 805

PostPosted: Wed Jun 21, 2006 2:35 am    Post subject: Re: forwarding without changing the header Reply with quote

Vahid Moghaddasi <vahid.moghaddasi@gmail.com> wrote:
Quote:

A "normal" forwarding instruction won't change the original "sender in the
header",

I just need the normal forwarding then. Is there an easy way to do this
after the mails are captured in Maildir format? I need to look for mails
that are *not* To or Cc to anyone at "example.com" then forward them to one
fixed e-mail address and deleting the rest.

Filter the maildir down to just messages that you want to send to a given
address, then do:

find Maildir/{cur,new}/ -type f \
| while read file ; do
new-inject -f <your_sender_address> <recipient> <"$file"
done

You can automate the filtering process with a little scripting glue and the
mess822 package.

Charles
--
--------------------------------------------------------------------------
Charles Cazabon <qmail@discworld.dyndns.org>
Read http://pyropus.ca/personal/writings/12-steps-to-qmail-list-bliss.html
My services include qmail consulting. See http://pyropus.ca/ for details.
--------------------------------------------------------------------------
Back to top
Vahid Moghaddasi
*nix forums addict


Joined: 25 Feb 2005
Posts: 96

PostPosted: Wed Jun 21, 2006 1:07 am    Post subject: Re: forwarding without changing the header Reply with quote

On 6/20/06, Charles Cazabon <qmail@discworld.dyndns.org> wrote:
Quote:

Vahid Moghaddasi <vahid.moghaddasi@gmail.com> wrote:
Is there a way to forward the mail in Maildir format to another address
without changing the original sender in the header?

A "normal" forwarding instruction won't change the original "sender in the
header",


I just need the normal forwarding then. Is there an easy way to do this
after the mails are captured in Maildir format? I need to look for mails
that are *not* To or Cc to anyone at "example.com" then forward them to one
fixed e-mail address and deleting the rest.
Thanks,
Back to top
Charles Cazabon
*nix forums Guru


Joined: 08 Jan 2005
Posts: 805

PostPosted: Tue Jun 20, 2006 1:42 pm    Post subject: Re: forwarding without changing the header Reply with quote

Vahid Moghaddasi <vahid.moghaddasi@gmail.com> wrote:
Quote:
Is there a way to forward the mail in Maildir format to another address
without changing the original sender in the header?

A "normal" forwarding instruction won't change the original "sender in the
header", if you mean the Return-Path: header field contents. However, the
receiving system may very well overwrite any existing Return-Path: header when
it receives it, creating a new one containing the envelope sender address.

If this isn't what you mean, please clarify.

Charles
--
--------------------------------------------------------------------------
Charles Cazabon <qmail@discworld.dyndns.org>
Read http://pyropus.ca/personal/writings/12-steps-to-qmail-list-bliss.html
My services include qmail consulting. See http://pyropus.ca/ for details.
--------------------------------------------------------------------------
Back to top
Vahid Moghaddasi
*nix forums addict


Joined: 25 Feb 2005
Posts: 96

PostPosted: Tue Jun 20, 2006 1:38 pm    Post subject: forwarding without changing the header Reply with quote

On 6/20/06, Thomas Raef <traef06@ebasedsecurity.com> wrote:
Quote:

How about qmailtap from Inter7?

Check it out:

http://www.inter7.com/?page=qmailtap


That is great but unfortunately I have a few patches installed on qmail and
the binaries are already rolled out and I am not sure how this patch will
interact with others, I really don't want to add another patch and make
another binary. I am looking for something external I can call e.g.
condredirect, etc..




--
This e-mail address is not monitored so please do not send me anything
important here. Thanks.
Back to top
Thomas Raef
*nix forums beginner


Joined: 10 Apr 2006
Posts: 21

PostPosted: Tue Jun 20, 2006 9:10 am    Post subject: RE: forwarding without changing the header Reply with quote

How about qmailtap from Inter7?

Check it out:

http://www.inter7.com/?page=qmailtap

________________________________

From: Vahid Moghaddasi [mailto:vahid.moghaddasi@gmail.com]
Sent: Mon 6/19/2006 8:39 PM
To: qmail@list.cr.yp.to
Subject: forwarding without changing the header


Hi all,
Is there a way to forward the mail in Maildir format to another address without changing the original sender in the header? I have never used serialsmtp so I am not sure if that is the best way. I need to do audit counting too, who ,where , how many, etc..

We copy once/day the contents of ~log/Maildir directory from several servers to a centralized repository for archiving.
Now we are required to send all the e-mails that we were archiving in the repository, to an off-site company in the form of an e-mail e.g. forward the mail to them.
Thanks,
Back to top
Vahid Moghaddasi
*nix forums addict


Joined: 25 Feb 2005
Posts: 96

PostPosted: Tue Jun 20, 2006 1:39 am    Post subject: forwarding without changing the header Reply with quote

Hi all,
Is there a way to forward the mail in Maildir format to another address
without changing the original sender in the header? I have never used
serialsmtp so I am not sure if that is the best way. I need to do audit
counting too, who ,where , how many, etc..

We copy once/day the contents of ~log/Maildir directory from several
servers to a centralized repository for archiving.
Now we are required to send all the e-mails that we were archiving in the
repository, to an off-site company in the form of an e-mail e.g. forward the
mail to them.
Thanks,
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [12 Posts] View previous topic :: View next topic
The time now is Sat Jan 10, 2009 1:31 am | All times are GMT
navigation Forum index » Apps » Qmail
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Unknown in header problem -SOLVED- Light Speed Postfix 0 Thu Jul 03, 2008 10:40 am
No new posts Filtering internal mail and forwarding to another domain fmaa1 Postfix 0 Wed Apr 30, 2008 12:50 pm
No new posts Insert header and footer in every page served by proxy ehmedk Apache 0 Tue Apr 22, 2008 6:27 pm
No new posts Insert header and footer in every page served by squid ehmedk Squid 0 Tue Apr 22, 2008 6:16 pm
No new posts Changing postfix's 600 chmod wdave Postfix 1 Mon Apr 14, 2008 1:23 am

Guitar Lesson | Credit Card | Loan | Online Advertising | Mobile Phones
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2729s ][ Queries: 20 (0.1362s) ][ GZIP on - Debug on ]