RE: [Exim] Email Forwards in MySQL database

Top Page
Delete this message
Reply to this message
Author: Eli
Date:  
To: stuart, exim-users
Subject: RE: [Exim] Email Forwards in MySQL database
You don't need the router_home_directory since it will be forwarding if it
finds a hit, and skipping the router if it doesn't. I don't think you want
file = , but rather data =.

Here is my forwarding router - which even supports multiple addresses (so an
addy can forward out to more than one final recipient):

virtual_user_fwd:
        driver                  = redirect
        verify                  = no
        check_ancestor          = yes
        hide_child_in_errmsg    = yes
        domains                 = +domain_virtual
        data                    = ${lookup mysql{SELECT fwd FROM userforward
WHERE host = '${quote_mysql:$domain}' AND user =
'${quote_mysql:$local_part}' AND fwd IS NOT NULL} {${sg{$value}{\\n}{, }}}}


Not sure if you want hide_child_in_errmsg - I was just testing that out...
It hides the final recipients if a bounceback is generated (try with it
on/off to see the difference).

Enjoy,

Eli.

-----Original Message-----
From: exim-users-admin@??? [mailto:exim-users-admin@exim.org] On Behalf
Of O'Reilly, Stuart
Sent: Saturday, December 27, 2003 5:27 PM
To: exim-users@???
Subject: [Exim] Email Forwards in MySQL database

I'm hoping someone can help me please. I'm building a mail server which will
house virtual users
only, no local users. I currently have a database set up with a table which
contains all the
information (email address, user name, password, quota, etc). I have another
table setup within this
database which contains the email address all email should be forwarded to
if the user has email
forwarding set up. I am using Squirrelmail (v1.4.2) as the front end and
have the 'Mail Forward'
plugin configured to plant the email address to forward to into the
database.

I am having a problem getting exim to pull the email address from the
database and forward mail to
it. After a couple of hours of using google and searching the exim archives,
I'm ready to give in.

virtual_userforward:
  driver = redirect
  router_home_directory = ${lookup mysql{ SELECT home FROM users \
         WHERE id='${quote_mysql:${local_part}@${domain}}' }}
  file = ${lookup mysql{ SELECT forward FROM email_forwards \
         WHERE id='${quote_mysql:${local_part}@${domain}}' }}
  no_verify
  no_expn
  forbid_filter_existstest
  forbid_filter_lookup
  check_ancestor
  allow_filter
  directory_transport = address_directory
  reply_transport = address_reply
  user = mail


When I sent an email to the account with the forwarding rule set up, I got
this in the exim logs:

2003-12-27 22:08:51 1AaMc7-0000Iq-26 <= stuart@???
H=myhost.aura-sols.co.uk
[217.155.123.xxx] U=1006 P=smtp S=1382
2003-12-27 22:08:51 1AaMc7-0000Iq-26 == test@???
R=virtual_userforward defer (-1):
"stuart@???" is not an absolute path

Stuart <at> aura-sols.co.uk is where the email is coming from.
Test <at> test-domain.co.uk is the receiving email account with forwarding
Stuart <at> forward-domain.org is where the email should be forwarded to.

This is what the email_forwards table looks like:

mysql> select * from email_forwards;
+------------------------------+-----------------------------------+
| id                                |  forward                             |

+------------------------------+-----------------------------------+
| test@??? | stuart@??? |

+------------------------------+-----------------------------------+

(Domains mangled to prevent spam).

Any help is gratefully received.

Regards,

Stuart O'Reilly
Aurora Solutions
===========





--

## List details at http://www.exim.org/mailman/listinfo/exim-users Exim
details at http://www.exim.org/ ##

---
[This E-mail scanned for viruses]



---
[This E-mail scanned for viruses]