On Thu, 2010-03-25 at 17:49 +0100, Gandalf Corvotempesta wrote:
> SELECT string FROM table WHERE header = 'From' \
>    AND $eximVariable REGEXP string
> 
> But we are unable to create the acl condition.
> Can someone help us?

This is a bit more of a MySQL question than an Exim one really.

Unless your MySQL works differently to mine, that regex will never
match. MySQL doesn't need the // on the start and end. Always get your
SQL working before trying to get it to work inside Exim.

Using the following as a reference
http://dev.mysql.com/doc/refman/5.1/en/regexp.html

I changed the table to be like this
> select * from test1;
+-------+------------------+
| name  | reg              |
+-------+------------------+
| From  | /.*<myt...@.*>$/ | 
| From2 | .*<myt...@.*>$   | 
+-------+------------------+

And then the SQL to 
> SELECT reg FROM test1 WHERE 'hippo <[email protected]>' REGEXP reg;
+----------------+
| reg            |
+----------------+
| .*<myt...@.*>$ | 
+----------------+
1 row in set (0.00 sec)

Adjusting your SQL to look like

SELECT 1 FROM table WHERE header = 'From' \
  AND ${quote_mysql:$h_from:} REGEXP string

There doesn't seem to be a point to returning the regular expression
used so I changed that to a 1 so the line equals true. And now turn it
into a condition ..

condition = ${lookup mysql{SELECT 1 FROM table WHERE header = 'From' \
  AND ${quote_mysql:$h_from:} REGEXP string}

Theoretically anyway .. not tested, your mileage may vary, things may
look larger in this mirror than they actually are


-- 
The Exim manual - http://docs.exim.org


-- 
## List details at http://lists.exim.org/mailman/listinfo/exim-users 
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Reply via email to