[Exim] Email Forwards in MySQL database

Top Page
Delete this message
Reply to this message
Author: O'Reilly, Stuart
Date:  
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
===========