Discussion:
dotqmail problem
(too old to reply)
silvietta
2008-01-21 17:17:37 UTC
Permalink
Hello you all,

I manage my company e-mail servers and I've a little problem, better a
little question, about dotqmail.

If I have my e-mail address, say ***@mycompany.it and I want to use
an alias, say ***@mycompany.it, I have just to create a
dotqmail file, say .qmail-silvietta, writing in it just
***@mycompany.it to get on silvia account any e-mail sento to
silvietta.

But if I want forwarded only some e-mail, say only e-mail from
***@myserver.mycompany.it, how can I do? I've found on the internet
that is possible to insert | statemets in qmail (http://
www.giunchi.net/wp-content/uploads/qmail-howto-3.html) so my question
is:

is it possible to have a,say, .qmail-silvia containing something like
"| /home/silvia/redirect " where redirect is a shell script in which I
tell to read the FROM field (with a cat or something else) and if it
contains the word "root" to redirect the e-mail to an external address
(like ***@external.com)?

Thank you in advance and best regards,

Silvia Z.
Howard Goldstein
2008-01-21 21:26:28 UTC
Permalink
On Mon, 21 Jan 2008 09:17:37 -0800 (PST), silvietta <***@gmail.com> wrote:
: is it possible to have a,say, .qmail-silvia containing something like
: "| /home/silvia/redirect " where redirect is a shell script in which I
: tell to read the FROM field (with a cat or something else) and if it
: contains the word "root" to redirect the e-mail to an external address
: (like ***@external.com)?

Yes. I have a large number of dotqmail files doing mail to netnews
gating by way ov a pipe to python scripts for further processing, for ex

|preline $HOME/mail2news.py


as the only line in the dotqmail for the mailing list "subscriber"
Howard Goldstein
2008-01-21 21:27:45 UTC
Permalink
On Mon, 21 Jan 2008 21:26:28 GMT, Howard Goldstein <***@mpcs.com> wrote:
: On Mon, 21 Jan 2008 09:17:37 -0800 (PST), silvietta <***@gmail.com> wrote:
: : is it possible to have a,say, .qmail-silvia containing something like
: : "| /home/silvia/redirect " where redirect is a shell script in which I
: : tell to read the FROM field (with a cat or something else) and if it
: : contains the word "root" to redirect the e-mail to an external address
: : (like ***@external.com)?
:
: Yes. I have a large number of dotqmail files doing mail to netnews
: gating by way ov a pipe to python scripts for further processing, for ex
:
: |preline $HOME/mail2news.py
:
:
: as the only line in the dotqmail for the mailing list "subscriber"


But note that this only works for an address like
myusername-whatever and the dotqmail file is .qmail-whatever

You'll need to play with aliases for your other forms of redirection
which are not dotqmail based
silvietta
2008-01-22 08:11:33 UTC
Permalink
Post by Howard Goldstein
: Yes. I have a large number of dotqmail files doing mail to netnews
: gating by way ov a pipe to python scripts for further processing, for ex
: |preline $HOME/mail2news.py
: as the only line in the dotqmail for the mailing list "subscriber"
But note that this only works for an address like
myusername-whatever and the dotqmail file is .qmail-whatever
You'll need to play with aliases for your other forms of redirection
which are not dotqmail based
Thank you Howard!
I was thinking about a shell script to process the FROM field of
incoming mail lookimg for "root" word (I need to receive on one of my
cellphone-manageables e-mail accounts LDAP messages coming from a
script when I'm nor at job neither at home or in a place where I can
log over the internet ... like when I go to the mountains ;-) ).
I'll try and I'll let you know.

Sil
silvietta
2008-01-24 17:53:57 UTC
Permalink
Post by silvietta
Post by Howard Goldstein
: Yes. I have a large number of dotqmail files doing mail to netnews
: gating by way ov a pipe to python scripts for further processing, for ex
: |preline $HOME/mail2news.py
: as the only line in the dotqmail for the mailing list "subscriber"
But note that this only works for an address like
myusername-whatever and the dotqmail file is .qmail-whatever
You'll need to play with aliases for your other forms of redirection
which are not dotqmail based
Thank you Howard!
I was thinking about a shell script to process the FROM field of
incoming mail lookimg for "root" word (I need to receive on one of my
cellphone-manageables e-mail accounts LDAP messages coming from a
script when I'm nor at job neither at home or in a place where I can
log over the internet ... like when I go to the mountains ;-) ).
I'll try and I'll let you know.
Sil
Sorry, another problem is rising now:

suppose my primary e-mail address (managed by qmail) is
***@mydomain.it and suppose I want to receive messages from
***@ldap.mydomain.it (sent from cron to ***@mydomain.it) also in,
say, ***@gmail.com, I must create a .qmail-silvia file this way:

/home/vpopmail/domains/mydomain/D/silvia/Maildir/ # this way I
get normally all my messages
| /home/silvia/copymsgs #
where copymsgs is a shell script to forward ***@ldap... 's messages
to ***@gmail.com

right?

The problem now is how to write the script itself; I try to better
explain: I was thinking to write something like this (1st thing that
came to my mind):

cat <message> | grep ***@ldap > root.txt
if [ -s root.txt ] then <forward>
fi
rm -f root.txt

but ... how tell the script on which file doing the cat command?
and ... how to tell qmail to forward if the test doesn't fail?

Thank you and best regards,

Sil
Howard Goldstein
2008-01-25 20:28:24 UTC
Permalink
On Thu, 24 Jan 2008 09:53:57 -0800 (PST), silvietta <***@gmail.com> wrote:
: On 22 Gen, 09:11, silvietta <***@gmail.com> wrote:
: > > :
: > > : Yes. I have a large number of dotqmail files doing mail to netnews
: > > : gating by way ov a pipe to python scripts for further processing, for ex
: > > :
: > > : |preline $HOME/mail2news.py
: > > :
: > > :
: > > : as the only line in the dotqmail for the mailing list "subscriber"
: >
: > > But note that this only works for an address like
: > > myusername-whatever and the dotqmail file is .qmail-whatever
: >
: > > You'll need to play with aliases for your other forms of redirection
: > > which are not dotqmail based
: >
: > Thank you Howard!
: > I was thinking about a shell script to process the FROM field of
: > incoming mail lookimg for "root" word (I need to receive on one of my
: > cellphone-manageables e-mail accounts LDAP messages coming from a
: > script when I'm nor at job neither at home or in a place where I can
: > log over the internet ... like when I go to the mountains ;-) ).
: > I'll try and I'll let you know.
: >
: > Sil
:
: Sorry, another problem is rising now:
:
: suppose my primary e-mail address (managed by qmail) is
: ***@mydomain.it and suppose I want to receive messages from
: ***@ldap.mydomain.it (sent from cron to ***@mydomain.it) also in,
: say, ***@gmail.com, I must create a .qmail-silvia file this way:
:
: /home/vpopmail/domains/mydomain/D/silvia/Maildir/ # this way I
: get normally all my messages
: | /home/silvia/copymsgs #
: where copymsgs is a shell script to forward ***@ldap... 's messages
: to ***@gmail.com
:
: right?
:
: The problem now is how to write the script itself; I try to better
: explain: I was thinking to write something like this (1st thing that
: came to my mind):
:
: cat <message> | grep ***@ldap > root.txt
: if [ -s root.txt ] then <forward>
: fi
: rm -f root.txt
:
: but ... how tell the script on which file doing the cat command?
: and ... how to tell qmail to forward if the test doesn't fail?
:
: Thank you and best regards,
:
: Sil
:

Maybe with multiple elif conditionals? May I suggest checking out
something like maildrop or procmail to handle your inbound message
processing? You can pipe from /var/qmail/aliases/blahs or dotqmails
to one of those packages and do some very cool stuff with much less
pain.
silvietta
2008-01-29 22:53:57 UTC
Permalink
Post by Howard Goldstein
Maybe with multiple elif conditionals? May I suggest checking out
something like maildrop or procmail to handle your inbound message
processing? You can pipe from /var/qmail/aliases/blahs or dotqmails
to one of those packages and do some very cool stuff with much less
pain.
Thank you again, Howard! I'll keep your suggestions in mind and I'll
try to set up something working.

For the moment, since the reason that made me thinking about
forwarding only root messages was a frivolous one (just to be able
checking my mail via cellphone when I'm at the mountain ... my domain
hasn't a wap frontend but gmail has), I've resolved (bypassed???) my
problem in another way.

I've been sick in these deays and had a lot of time to think, so it
came to my mind simply to create a .qmail-fakesilvia this way:

***@mydomain.it
***@gmail.com

and modified the script in cron to send root messages to
***@mydomain.it

I know that is a bad way to solve similar problems, but it's also the
easiest ;-)

Best regards and thank you again

Sil
Andreas F. Borchert
2008-03-29 08:03:26 UTC
Permalink
Post by silvietta
is it possible to have a,say, .qmail-silvia containing something like
"| /home/silvia/redirect " where redirect is a shell script in which I
tell to read the FROM field (with a cat or something else) and if it
contains the word "root" to redirect the e-mail to an external address
Yes, using the dot-qmail-utils [1], you are free to write this:

condredirect ***@external.com ifheader -r '^From.*root'

Andreas.

[1] http://dotqmailutils.sourceforge.net/

Loading...