follow up: Reading an array from a flat file

Helga Mayer helga.mayer at uni-hohenheim.de
Wed Aug 17 14:33:21 CEST 2011


Quoting Helga Mayer <Helga.Mayer at uni-hohenheim.de>:

>
> Hello list,
>
> I have some 50 users (out of 10000) for whom I want to bypass  
> spamchecking. Instead of writing the addresses literally in  
> amavisd.conf
> I would prefer to store them in a file. Could this be done in
> amavisd.conf or will I have to modify amavisd ?
>
> Will the following code work ?
>
> my $path_mailaddr = '/etc/postfix/bypass_spam_checks';
> my @all_mailaddr = ();
> open(MAILADDR, "<$path_mailaddr") || die "cannot open bypass_spam_checks\n";
> @all_mailaddr = <MAILADDR>;
> my %bypass_spam_checks = ();
> map { $bypass_spam_checks{lc($_)}=1 } (@all_mailaddr);
>
> close(MAILADDR);
>
> /etc/postfix/bypass_spam_checks contains:
>
> user1 at mydomain.de
> user2 at mydomain.de
> ....
> user50 at mydomain.de

I forgot to mention I already tried the builtin function read_array.


map { $bypass_spam_checks{lc($_)}=1 }  
(read_array('/etc/postfix/bypass_spam_checks'));

amavisd was starting without errors, but the content of  
etc/postfix/bypass_spam_checks was ignored.

>
> Thank you for any help
> Helga
>
>
> Helga Mayer
> Universität Hohenheim
> Kommunikations-, Informations- und Medienzentrum (630)
> IT-Dienste | Mail
>
> Schloss-Westhof-Süd | 70599 Stuttgart
> Tel.:  +49 711 459-22838 | Fax: +49 711 459-23449
> https://kim.uni-hohenheim.de
>
>
> ***************************************************************************
> A: Because we read from top to bottom, left to right.
> Q: Why should i start my reply below the quoted text?



Helga Mayer
Universität Hohenheim
Kommunikations-, Informations- und Medienzentrum (630)
IT-Dienste | Mail

Schloss-Westhof-Süd | 70599 Stuttgart
Tel.:  +49 711 459-22838 | Fax: +49 711 459-23449
https://kim.uni-hohenheim.de




More information about the amavis-users mailing list