Re: recipient_delimiter and virtual users

2009-02-12 Thread mouss
post...@corwyn.net a écrit :
> [snip]
> 
> So while recipient_delimited works "out of the box" it doesn't quite do
> what I want (hence why I provided not only what wasn't working, but a
> detailed explanation of what I wanted to solve.)
> 

but you didn't talk about folders in your post, did you? you simply said
that mail failed with "unknown recipient".

>[snip]
> 
> Off to go see if I can find a "better" way with dovecot. Thanks.
> 

if you run dovecot with -m ${extension} it will use the extension as the
folder name. if you don't use -n, it will also create the folder.


Re: recipient_delimiter and virtual users

2009-02-12 Thread postfix

At 12:47 PM 2/12/2009, Victor Duchovni wrote:

On Thu, Feb 12, 2009 at 12:33:57PM -0500, post...@corwyn.net wrote:

> At 04:28 AM 2/12/2009, mouss wrote:
>> recipient_delimiter works "out of the box". there is no need to change
>> your tables, your sql statements nor add users.
This up to your LDA. No LDA bundled with Postfix understands "folders".


So while recipient_delimited works "out of the box" it doesn't quite 
do what I want (hence why I provided not only what wasn't working, 
but a detailed explanation of what I wanted to solve.)



These issues are dealt with by Mailstore aware delivery agents, not
the MTA. Deploy a delivery agent that co-operates with your mailstore
(Cyrus, Dovecot, ...). Postfix will pass the address and extension to
the delivery agent.


Thank you, that answers that receipient_delimiter alone will not 
solve the thing I want it to.


Well, I tinkered with it for a while, and  changed 
mysql_virtual_user_maps SQL to:
query = select 
if(instr('%s','+'),concat(maildir,'Maildir/.',mid('%s',instr('%s','+')+1,instr('%s','@') 
- instr('%s','+')-1),'/'),CONCAT(maildir,'Maildir/')) from mailbox 
where 
username=if(instr('%s','+'),concat(left('%s',instr('%s','+')-1),right('%s',length('%s') 
- instr('%s','@')+1)),'%s') AND active=1;


My previous sql I had managed to remove all references to the input 
address, but with recipient_delimiter, the first query to validate 
deliver is as user+...@example.com, but the second query is to 
u...@example.com, thus I no longer have available what the +foo part 
is for evaulation.



While this new SQL  does permit random folders be created on the 
drive, they're forced into the appropriate mail structure and 
everything works as per my desired solution. Mail sent to 
u...@example.com delivers to inbox, mail sent to user+...@example.com 
will deliver to the foo folder.  It doesn't exactly what I want it to 
(potential vulnerabilities aside, but everything looks like it 
escapes out properly to inhibit SQL injection issues).


Off to go see if I can find a "better" way with dovecot. Thanks.

Rick



Re: recipient_delimiter and virtual users

2009-02-12 Thread Victor Duchovni
On Thu, Feb 12, 2009 at 12:33:57PM -0500, post...@corwyn.net wrote:

> At 04:28 AM 2/12/2009, mouss wrote:
>> recipient_delimiter works "out of the box". there is no need to change
>> your tables, your sql statements nor add users.
>
> The problem is I don't know what the "out of the box" behavior should be.
>
> If I set recipient_delimiter = + then mail to u...@example.com, 
> user+...@example.com, and user+spam all deliver to INBOX, regardless of 
> whether there is a spam or foo folder created.
>
> What I want is, without having to set filters in the client, for mail to 
> deliver to the appropriate folder.

This up to your LDA. No LDA bundled with Postfix understands "folders".
Cyrus IMAP understands folders, and even knows that "user+foo" only
goes to folder "foo" when the folder's ACL allows anonymous "POST",
otherwise mail goes to the "Inbox".

These issues are dealt with by Mailstore aware delivery agents, not
the MTA. Deploy a delivery agent that co-operates with your mailstore
(Cyrus, Dovecot, ...). Postfix will pass the address and extension to
the delivery agent.

-- 
Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:


If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.


Re: recipient_delimiter and virtual users

2009-02-12 Thread postfix

At 04:28 AM 2/12/2009, mouss wrote:

recipient_delimiter works "out of the box". there is no need to change
your tables, your sql statements nor add users.


The problem is I don't know what the "out of the box" behavior should be.

If I set recipient_delimiter = + then mail to u...@example.com, 
user+...@example.com, and user+spam all deliver to INBOX, regardless 
of whether there is a spam or foo folder created.


What I want is, without having to set filters in the client, for mail 
to deliver to the appropriate folder.


What is the default behavior I should expect from recipient_delimiter 
with user+...@example.com? Should mail:

go to the default inbox always, or
go to a folder foo if it's been created and inbox otherwise
go to a folder foo if it's been created, or if the folder isn't there 
create foo and place the mail in that folder?


Once I know what it should do, it's a lot easier for me to figure out 
what's broken/misconfigured :-) and ask for help appropriately.


Thanks!

Rick





Re: recipient_delimiter and virtual users

2009-02-12 Thread mouss
post...@corwyn.net a écrit :
> 
> 
> OK, so I've become intrigued with recipient delimiters.
> 
> My users are currently stored in a mysql database, 'postfix'.  The table
> format is as postfixadmin sets it up, so in the  username is the user
> email address u...@example.com
> 
> Before I started tinkering, email to u...@example.com worked. Email to
> user+...@example.com failed with "unknown recipient", all well and good.
> 
> It looks like even with recipient_delimiter = + set, mail is still
> bounced for the same reason. I theorize that recipient_delimiter is
> actually checked at the end of the address such that with it enabled
> what I really have is u...@example.com+foo working (which, of course,
> won't work).
> 
> Does this mean that I can't really use recipient_delimiter with my users
> defined as u...@example.com? If so, I presume I need to munge up (even
> more) my SQL statement so that instead of checking for username='%s' 
> I'm going to need to strip %s apart into its constituent components and
> then reassemble it, so that user+...@example.com, user+...@example.com
> works?  Or would I just use '%d', which looks like it might be the left
> side of the email address (tho I'd still have to make the SQL match that).
> 
> The end result that would be cool would be that if foo was defined as a
> folder, mail would get delivered there, and if not mail would be
> delivered to the default inbox.
> 
> I can currently (with my existing sql) create a second user
> user+...@example.com and get mail to deliver to inbox/foo , but that
> means that a) I have to maintain a u...@example.com AND a
> user+...@example.com, and additionally if I want to add additional
> extensions I have to create additional accounts, which seems tiresome.
> 
> Thanks for any guidance!
> 

recipient_delimiter works "out of the box". there is no need to change
your tables, your sql statements nor add users.

if it doesn't work for you, then you have something misconfigured. to
get help, follow the directions in
http://www.postfix.org/DEBUG_README.html#mail

In particular:
- logs
- postconf -n




recipient_delimiter and virtual users

2009-02-11 Thread postfix



OK, so I've become intrigued with recipient delimiters.

My users are currently stored in a mysql database, 'postfix'.  The 
table format is as postfixadmin sets it up, so in the  username is 
the user email address u...@example.com


Before I started tinkering, email to u...@example.com worked. Email 
to user+...@example.com failed with "unknown recipient", all well and good.


It looks like even with recipient_delimiter = + set, mail is still 
bounced for the same reason. I theorize that recipient_delimiter is 
actually checked at the end of the address such that with it enabled 
what I really have is u...@example.com+foo working (which, of course, 
won't work).


Does this mean that I can't really use recipient_delimiter with my 
users defined as u...@example.com? If so, I presume I need to munge 
up (even more) my SQL statement so that instead of checking for 
username='%s'  I'm going to need to strip %s apart into its 
constituent components and then reassemble it, so that 
user+...@example.com, user+...@example.com works?  Or would I just 
use '%d', which looks like it might be the left side of the email 
address (tho I'd still have to make the SQL match that).


The end result that would be cool would be that if foo was defined as 
a folder, mail would get delivered there, and if not mail would be 
delivered to the default inbox.


I can currently (with my existing sql) create a second user 
user+...@example.com and get mail to deliver to inbox/foo , but that 
means that a) I have to maintain a u...@example.com AND a 
user+...@example.com, and additionally if I want to add additional 
extensions I have to create additional accounts, which seems tiresome.


Thanks for any guidance!

rick



Rick Steeves
http://www.sinister.net

"The journey is the destination"