Re: Per recipient restrictions On 02/27/2008 08:19 AM, Mike Morris wrote:
> Hi all,
> 
> I would like to work on a configuration that allows individual 
> recipients to opt out of any combination of a number of restrictions.  I 
> am having difficulty determining how to best do this within Postfix.  I 
> have already created the interface which allows users to select up to 
> six restrictions to opt out of.  It stores a row in a MySQL table with 
> the recipient address and a boolean value for each of the six checks 
> that the user can choose to opt out of.
> 
> My initial idea was to generate CDB maps based on the information from 
> the MySQL table, one map for each of the restrictions a recipient is 
> allowed to opt out of.  Each map would return a 'DUNNO' action for email 
> addresses that chose to opt out for that one check and return a 
> restriction class that enabled that restriction for everyone else. These 
> maps would then replace the respective restrictions in the appropriate 
> smtpd_*_restrictions stanza.  The problem with this is, unless I am 
> missing something, there is no way to return a default action to call a 
> restriction class for hash, CDB, etc.  A PCRE map could be used to do 
> what I wanted.  But that got me thinking that perhaps I was going about 
> this the wrong way.
> 
> Doubtless this has been discussed before.  The closest I can find in the 
> archives is this one:
> 
> http://groups.google.com/group/list.postfix.users/browse_thread/thread/2f452e71834581bf/65a4ad03b74a0b42?lnk=gst&q=per+recipient+restrictions# 
> 
> 
> There was a suggestion in that thread to use regex/PCRE as well.  Is 
> doing so a decent enough approach?  Or is there a better way to 
> accomplish what I am trying to do?
> 
> If more information is required, let me know.  Thanks.


For what it's worth I decided to go with the PCRE approach for now to 
get this up and running.  When I have more time I'll probably look at 
doing this with a policy daemon, a la Postfilter.

Thanks for the input.


