Re: postfix, use a custom mysql user table to reject messages

2014-04-17 Thread Rob Tanner
Andy,

Should work just fine.  Google postfix relay_recipient_maps mysql”.  I have a 
similar issue in that my two edge servers deliver email to an Exchange server 
which is where user account live.  The only difference is that I’ve been using 
LDAP rather than mysql.  I also depend heavily on LDAP for aliases and and 
group distribution lists.  If Postfix couldn’t do that kind of stuff I don’t 
know what I would do.  And so I’d bet that with a little googling around you 
would discover how to do aliases out of mysql as well.

Good luck.

Rob Tanner
UNIX Services Manager
Linfield College, McMinnville Oregon

ITS will never ask you for your password.  Please don’t share yours with anyone!

On Apr 16, 2014, at 3:00 PM, Andy Yen 
andy...@hep.caltech.edumailto:andy...@hep.caltech.edu wrote:

Hi postfixers,
   To send fewer email bounce messages, I would like to reject messages at 
the SMTP session if either the user doesn't exist, or the user has exceeded 
their quota. My mail setup is a bit different in that I only use postfix for 
receiving messages, user accounts and local storage is handled completely 
outside of postfix. What I do have is a custom mysql table that lists usernames 
in my mail system, and whether they have exceeded quota or not. I can of course 
reformat this table or duplicate it.

Is there a way to have postfix look in this mysql table, verify the user exists 
and is not over quota, and then reject or accept the message within the SMTP 
session?

Looking through the docs, there doesn't appear to be an out of the box way to 
do this, but perhaps there is a way to take advantage of how postfix currently 
does its user lookup at this stage of message processing to achieve this 
functionality? Or is my only option to go in and modify the source code?

Cheers,
Andy



postfix, use a custom mysql user table to reject messages

2014-04-16 Thread Andy Yen

Hi postfixers,
   To send fewer email bounce messages, I would like to reject 
messages at the SMTP session if either the user doesn't exist, or the 
user has exceeded their quota. My mail setup is a bit different in that 
I only use postfix for receiving messages, user accounts and local 
storage is handled completely outside of postfix. What I do have is a 
custom mysql table that lists usernames in my mail system, and whether 
they have exceeded quota or not. I can of course reformat this table or 
duplicate it.


Is there a way to have postfix look in this mysql table, verify the user 
exists and is not over quota, and then reject or accept the message 
within the SMTP session?


Looking through the docs, there doesn't appear to be an out of the box 
way to do this, but perhaps there is a way to take advantage of how 
postfix currently does its user lookup at this stage of message 
processing to achieve this functionality? Or is my only option to go in 
and modify the source code?


Cheers,
Andy


Re: postfix, use a custom mysql user table to reject messages

2014-04-16 Thread Wietse Venema
Andy Yen:
 Hi postfixers,
 To send fewer email bounce messages, I would like to reject 
 messages at the SMTP session if either the user doesn't exist, or the 
 user has exceeded their quota. My mail setup is a bit different in that 
 I only use postfix for receiving messages, user accounts and local 
 storage is handled completely outside of postfix. What I do have is a 
 custom mysql table that lists usernames in my mail system, and whether 
 they have exceeded quota or not. I can of course reformat this table or 
 duplicate it.

You configure the domain in relay_domains, and you configure the
valid recipients with relay_recipient_maps.

 Is there a way to have postfix look in this mysql table, verify the user 
 exists and is not over quota, and then reject or accept the message 
 within the SMTP session?

You provide the query according to the rules in the Postfix
mysql_table(5) manpage, and return the information that is needed
by relay_recipient_maps.

http://www.postfix.org/postconf.5.html#relay_recipient_maps

See also the domain pseudo-parameter in mysql_table(5) to cut
down on the number of MySQL database queries.

I suggest starting with a hash map and make it work for some users,
then using the instructions in http://www.postfix.org/DATABASE_README.html
to make the transition to MySQL.

Wietse