Discussion:
forward a relayed mail?
(too old to reply)
Marco Tiraferri
2008-10-27 16:47:04 UTC
Permalink
Hallo!

I've a qmail on a ununtu system.
it's working to relay incoming mail to the mailserver behind the firewall.

is it possible to use the forwarding option in qmail?




This is the situation:
in /var/qmail/control/smtproutes:
mydomain.it:192.168.0.3
(all the mail directed to mydomain.it are relayed to 192.168.0.3)

but some users need all the mail to be forwarded to their private
mailbox (p.e. the address ***@mydomain.it should be forwarded to
***@private.it)

Is there a way to do it directly with qmail?

Tryed with
/var/qmail/alias/.qmail-user
&***@private.it

but it doesn't work!

Thank's for any help

Marco Tiraferri
Dave Sill
2008-10-27 18:54:51 UTC
Permalink
Post by Marco Tiraferri
Tryed with
/var/qmail/alias/.qmail-user
but it doesn't work!
Do you have a "user" user on the system? If so, the mail will be
delivered to that user, not to user "alias". If that's not the
problem, I'll need more details about what "doesn't work" means.
--
Dave Sill Author, The qmail Handbook
Oak Ridge National Lab, IT Services <http://lifewithqmail.org/>
Marco Tiraferri
2008-10-28 08:33:08 UTC
Permalink
Post by Dave Sill
Post by Marco Tiraferri
Tryed with
/var/qmail/alias/.qmail-user
but it doesn't work!
Do you have a "user" user on the system? If so, the mail will be
delivered to that user, not to user "alias". If that's not the
problem, I'll need more details about what "doesn't work" means.
I don't have the user on the system. the only user in this sistem is the
system administrator (me) and the qmail's users.

This system have to relay mails directed to mydomain.it to the internal
mail server (running lotus domino)

Here the config files in /var/qmail/control/
concurrenciincoming
20

control
mydomain.it:192.168.0.7

defaultdelivery
./Mailbox

defaultdomain
mydomain.it

locals
server.mydomain.it

me
mydomain.it

plusdomain
mydomain.it

rcpthosts
server.mydomain.it
192.168.0.3
192.168.0.5
192.168.0.6
192.168.0.7
mydomain.it

smtproutes
mydomain.it:192.168.0.3
192.168.0.3
192.168.0.5
192.168.0.6
192.168.0.7
comune.riccione.rn.

All the mails are routed to the domino server, in this envirnoment some
restriction make difficult the address forwarding.

So i tryed to use the alias/.qmail-user
/var/qmail/alias/.qmail-user
&***@private.it

I was expecting all mail directed to ***@mydomain.it should be
forwarded to ***@private.it, but noththing happens, the mail was
relayed to the internal server as usually.

I'm new to qmail, don't know if is possible do this forward....

thank's
Marco
Dave Sill
2008-10-28 19:08:11 UTC
Permalink
Post by Marco Tiraferri
Post by Dave Sill
Post by Marco Tiraferri
Tryed with
/var/qmail/alias/.qmail-user
but it doesn't work!
Do you have a "user" user on the system? If so, the mail will be
delivered to that user, not to user "alias". If that's not the
problem, I'll need more details about what "doesn't work" means.
I don't have the user on the system. the only user in this sistem is
the system administrator (me) and the qmail's users.
This system have to relay mails directed to mydomain.it to the
internal mail server (running lotus domino)
OK, you're accomplishing that now by having mydomain.it in rcpthosts
but not in localhosts, and an entry in smtproutes that points to the
internal server.

That means that mail to ***@mydomain.it is not considered local, so
local deliver won't be attempted, of course.

What you need to do is redirect the mail to the internal server using
a virtualdomains entry. E.g., in control/virtualdomains:

mydomain.it:alias-mydomain.it

Then in ~alias/.qmail-mydomain:it-default you forward to the internal
server using:

|forward $***@ip-of-internal-domino-server

Then, for a specific user that you want to redirect elsewhere, you
create a ~alias/.qmail-mydomain:it-user file containing, e.g.:

&***@private.it
--
Dave Sill Author, The qmail Handbook
Oak Ridge National Lab, IT Services <http://lifewithqmail.org/>
Marco Tiraferri
2008-10-30 11:28:33 UTC
Permalink
Post by Dave Sill
Post by Marco Tiraferri
Post by Dave Sill
Post by Marco Tiraferri
Tryed with
/var/qmail/alias/.qmail-user
but it doesn't work!
Do you have a "user" user on the system? If so, the mail will be
delivered to that user, not to user "alias". If that's not the
problem, I'll need more details about what "doesn't work" means.
I don't have the user on the system. the only user in this sistem is
the system administrator (me) and the qmail's users.
This system have to relay mails directed to mydomain.it to the
internal mail server (running lotus domino)
OK, you're accomplishing that now by having mydomain.it in rcpthosts
but not in localhosts, and an entry in smtproutes that points to the
internal server.
local deliver won't be attempted, of course.
What you need to do is redirect the mail to the internal server using
mydomain.it:alias-mydomain.it
Then in ~alias/.qmail-mydomain:it-default you forward to the internal
Then, for a specific user that you want to redirect elsewhere, you
First, i made a mistake in my post...
smtproutes
mydomain.it:192.168.0.3
192.168.0.3
192.168.0.5
192.168.0.6
192.168.0.7
comune.riccione.rn. <- this line had to be mydomain.it

I made a try...
1) create a file /var/qmail/control/virtualdomains
mydomain.it:alias-mydomain.it

2) create a file /var/qmail/alias/.qmail-mydomain.it-default
|forward $***@192.168.0.3

3) create a file /var/qmail/alias/.qmail-mydomain.it-marco
&***@private.it

4) sudo qmailctl restart

But the test mail i send has this message:
<***@mydomain.it>:
Sorry, no mailbox here by that name. (#5.1.1)
and, i think, all the mail directed to mydomain have been rejected too!
i've seen in qmail log file some error like this one:
================================================
new msg 493065
info msg 493065: bytes 1144 from <***@libero.it> qp 13768 uid 1003
starting delivery 5: msg 493065 to local
alias-mydomain.it-***@mydomain.it
status: local 1/10 remote 0/20
delivery 5: failure: Sorry,_no_mailbox_here_by_that_name._(#5.1.1)/
status: local 0/10 remote 0/20
bounce msg 493065 qp 13798
end msg 493065
================================================
So i have renamed the files created.

some minor question:
when you write ~alias/.qmail-mydomain:it-user:
- what does "~" mean? i think "/var/qmail/alias" is right?
- mydomain:it the colon(:) is a mistake, or in this case i should
replace dots by colon?
Dave Sill
2008-10-30 19:06:00 UTC
Permalink
Post by Marco Tiraferri
- what does "~" mean? i think "/var/qmail/alias" is right?
~username means "the home directory of user username", so, yes,
/var/qmail/alias is probably ~alias. Try:

$ echo ~alias
/var/qmail/alias
$
Post by Marco Tiraferri
- mydomain:it the colon(:) is a mistake, or in this case i should
replace dots by colon?
Yes, replace dots with colons in .qmail filenames. See:

http://lifewithqmail.org/lwq.html#dots-in-extensions
--
Dave Sill Author, The qmail Handbook
Oak Ridge National Lab, IT Services <http://lifewithqmail.org/>
Marco Tiraferri
2008-10-31 10:40:55 UTC
Permalink
Post by Dave Sill
Post by Marco Tiraferri
- what does "~" mean? i think "/var/qmail/alias" is right?
~username means "the home directory of user username", so, yes,
$ echo ~alias
/var/qmail/alias
$
Post by Marco Tiraferri
- mydomain:it the colon(:) is a mistake, or in this case i should
replace dots by colon?
http://lifewithqmail.org/lwq.html#dots-in-extensions
VERY VERY THANK'S YOU!!

Of course the problem was i'm using dot instead of colon!

Make some test on my testing environment and find the way...

the only difference was in the
~alias/.qmail-mydomain:it-default
using: $***@192.168.0.7

the domino internal server refjected the mail, but using:
$***@servername.mydomain.it

All worked fine!!

Thank's again

Marco


|forward $***@ip-of-internal-domino-server
Dave Sill
2008-10-31 15:24:30 UTC
Permalink
Post by Marco Tiraferri
VERY VERY THANK'S YOU!!
Glad to help, Marco. Good luck with qmail. I think you'll find it's
very reliable.
--
Dave Sill Author, The qmail Handbook
Oak Ridge National Lab, IT Services <http://lifewithqmail.org/>
Loading...