I am not even sure if this is possible. I cannot find an example of it anywhere. I am in the process of setting up a "plus" addressing system. The addresses would be addresses to accounts like <sales+USERNAME at domain.com>. there are presently 50 such names in sales. This is the one line entry I presently have in the sieve script: if envelope :detail "To" "joe" {fileinto "joe"; stop;} Now, what I would like to do is find a way to do this: if envelope :detail "To" "joe" {fileinto :detail; stop} That does not work though. I really do not want to list every available user individually since it will eventually become a nightmare to maintain. Is there any way in a sieve script to assign the value of ":detail" to another variable and use that variable in the "fileinto" portion of the script? I would also need to maintain the same case folding so as not to create multiple folders with the same name; ie, Joe, joe, jOe. Thanks! -- Jerry ? Dovecot.user at seibercom.net Disclaimer: off-list followups get on-list replies or get ignored. Please do not ignore the Reply-To header. __________________________________________________________________ Between grand theft and a legal fee, there only stands a law degree.
On 4/24/2011 10:29 PM, Jerry wrote:> I am not even sure if this is possible. I cannot find an example of it > anywhere. > > I am in the process of setting up a "plus" addressing system. The > addresses would be addresses to accounts like > <sales+USERNAME at domain.com>. there are presently 50 such names in sales. > > This is the one line entry I presently have in the sieve script: > > if envelope :detail "To" "joe" {fileinto "joe"; stop;} > > Now, what I would like to do is find a way to do this: > > if envelope :detail "To" "joe" {fileinto :detail; stop} > > That does not work though. I really do not want to list every available > user individually since it will eventually become a nightmare to > maintain. Is there any way in a sieve script to assign the value of > ":detail" to another variable and use that variable in the "fileinto" > portion of the script? I would also need to maintain the same case > folding so as not to create multiple folders with the same name; ie, > Joe, joe, jOeThe variables extension is what you need. Here's an example: require ["variables", "envelope", "fileinto", "subaddress"]; if envelope :is :user "to" "sales" { if envelope :matches :detail "to" "*" { /* Save name in ${name} in all lowercase except for the first letter. * Joe, joe, jOe thus all become 'Joe'. */ set :lower :upperfirst "name" "${1}"; } if string :is "${name}" "" { /* Default case if no detail is specified */ fileinto "sales"; } else { /* For sales+joe@ this will become users/Joe */ fileinto "users/${name}"; } } Regards, Stephan.
On Mon, 25 Apr 2011 15:49:54 +0200 Stephan Bosch <stephan at rename-it.nl> articulated:> On 4/24/2011 10:29 PM, Jerry wrote: > > I am not even sure if this is possible. I cannot find an example of > > it anywhere. > > > > I am in the process of setting up a "plus" addressing system. The > > addresses would be addresses to accounts like > > <sales+USERNAME at domain.com>. there are presently 50 such names in > > sales. > > > > This is the one line entry I presently have in the sieve script: > > > > if envelope :detail "To" "joe" {fileinto "joe"; stop;} > > > > Now, what I would like to do is find a way to do this: > > > > if envelope :detail "To" "joe" {fileinto :detail; stop} > > > > That does not work though. I really do not want to list every > > available user individually since it will eventually become a > > nightmare to maintain. Is there any way in a sieve script to assign > > the value of ":detail" to another variable and use that variable in > > the "fileinto" portion of the script? I would also need to maintain > > the same case folding so as not to create multiple folders with the > > same name; ie, Joe, joe, jOe > > The variables extension is what you need. Here's an example: > > > require ["variables", "envelope", "fileinto", "subaddress"]; > > if envelope :is :user "to" "sales" { > if envelope :matches :detail "to" "*" { > /* Save name in ${name} in all lowercase except for the > first letter. > * Joe, joe, jOe thus all become 'Joe'. > */ > set :lower :upperfirst "name" "${1}"; > } > > if string :is "${name}" "" { > /* Default case if no detail is specified */ > fileinto "sales"; > } else { > /* For sales+joe@ this will become users/Joe */ > fileinto "users/${name}"; > } > }Thanks! I will try putting that into effect later this week. I want to clean up a few other problems first. I thought I had to use replaceable variables; however, I could not find any easy to understand documentation on it. Most of what I was reading was just getting me confused. -- Jerry ? Dovecot.user at seibercom.net Disclaimer: off-list followups get on-list replies or get ignored. Please do not ignore the Reply-To header. __________________________________________________________________