Re: [exim] auto whitelist

Top Page
Delete this message
Reply to this message
Author: Craig Jackson
Date:  
To: Joseph, exim-users
Subject: Re: [exim] auto whitelist


> -----Original Message-----
> From: exim-users-bounces@???
> [mailto:exim-users-bounces@exim.org] On Behalf Of Joseph
> Sent: Wednesday, February 07, 2007 8:12 AM
> To: exim users
> Subject: [exim] auto whitelist
>
> >>> > !domains = mysql;SELECT domainname FROM exim_whitelist WHERE \
> >>> > domainname='${quote_mysql:@$domain}'
> >>> >
> >>> > This does not work. Any help would be appreciated.
> >
> >> The database contains a simple domainname filed with the
> domain.com
> >> without the @.
> >
> > Hello.
> > That's how I use auto-whitelisting in Exim:
> >
> > domainlist      white_domains = ${lookup mysql{SELECT sender \
> >                         FROM whitelist \
> >                         WHERE type=1 AND 
> > sender='${quote_mysql:$sender_address_domain}'}{$value}fail}

> >
> > (I have type=1 for domains and type=2 for addresses)
> >
> >
> > And in ACL section:
> >
> > # Accept whitelist domains
> > accept sender_domains = +white_domains
>
>
>
> Looking at the auto whitelist options,
>
> Is there a way to to populate the table with all the domains
> of sent email?
>
> I saw reference to making a function.
> Is there a sample such function around someone would want to share?
>
> --
> respectfully, Joseph ===============
> -                                  =



If I understand you correctly, you want Exim to send the $recipients
variable containing all of the recipients in order to add them to a
whitelist table. I posted this very same request recently and was told
that there are two options.

1) Create a recursive acl (which I did not explore)
2) Upgrade Mysql to 5+ and use a stored procedure (which I did explore
and tested but not in a production environment). See stored procedure
below which I wrote.

| s_p       |          | CREATE DEFINER=`root`@`localhost` PROCEDURE

`s_p`(IN REC TEXT)
BEGIN
DECLARE LOC INT;
DECLARE ADDR VARCHAR(255);
DECLARE REM TEXT;
SET LOC = LOCATE(', ',REC);
SET REM = REC;
IF LOC = 0 THEN
        INSERT IGNORE INTO test_addresses (address) VALUES (REC);
ELSE
        WHILE LOC > 0 DO
                SET ADDR = LEFT(REM,LOC-1);
                INSERT IGNORE INTO test_addresses (address) VALUES
(ADDR);
                SET REM = RIGHT(REM,LENGTH(REM)-LOC-2);
                SET LOC = LOCATE(', ',REM);
                IF LOC = 0 THEN
                        INSERT IGNORE INTO test_addresses (address)
VALUES (REM);
                END IF;
        END WHILE;
END IF;
END |