#1  
Old 6th July 2009, 17:14
Rescue9 Rescue9 is offline
Member
 
Join Date: Jun 2007
Posts: 52
Thanks: 4
Thanked 3 Times in 2 Posts
Default Mail Filter

I can't understand how to get the mail filter to work with folders that contain spaces. I'm coming from an ISPConfig2 setup and the procmail.rc worked wonderfully with this, but .mailfilter doesn't want to play nice.

I have multiple folders titled .Yahoo Groups.MyYahooGroup. In the procmailrc it was listed as \.Yahoo\ Groups\.MyYahooGroup. I've tried every configuration of that I could, and even searched the web. The only fix I could find was actually nesting the entire directory inside quotes, but this would require the user manually editing the .mailfilter as opposed to using the web frontend.

Any help is appreciated!
Reply With Quote
Sponsored Links
  #2  
Old 7th July 2009, 12:13
Rescue9 Rescue9 is offline
Member
 
Join Date: Jun 2007
Posts: 52
Thanks: 4
Thanked 3 Times in 2 Posts
Default

Is there no way to use a folder name that has a space in it now?

If this is not possible with the current setup, is it possible to rewrite the code that generates the .mailfilter file from the web front end. My understanding is that if the folder name is in quotes, then it should work correctly. If the script that generates the .mailfilter file rewrote the filter as a variable, rather than inputting the text directly inline, then it might be possible to use various folder names.

MyFilterName="$DEFAULT/.Yahoo Groups.MyFolderName"

I've gotten my information from various places, but here is the one that most accurately describes what I'm trying to say: http://www.nabble.com/Maildrop-TO-ex...d17189650.html
Reply With Quote
  #3  
Old 7th July 2009, 12:20
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,486
Thanks: 813
Thanked 5,255 Times in 4,121 Posts
Default

Please post this to the bugtracker and we will check this:

http://bugtracker.ispconfig.org
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #4  
Old 7th July 2009, 15:19
Rescue9 Rescue9 is offline
Member
 
Join Date: Jun 2007
Posts: 52
Thanks: 4
Thanked 3 Times in 2 Posts
Default

Bug Report submitted: #806
Reply With Quote
  #5  
Old 8th July 2009, 01:59
Rescue9 Rescue9 is offline
Member
 
Join Date: Jun 2007
Posts: 52
Thanks: 4
Thanked 3 Times in 2 Posts
Default

Forgive me if I start thinking aloud here, but I'm hoping that someone might be able to interpret my ramblings. Keep in mind that at this time THIS CODE DOES NOT WORK. DO NOT TRY TO USE IT. I'm going to try debugging this later myself and also manually edit the .mailfilter code to see if using a variable overcomes the space. If it does, then editing the code to use a variable should kill the bug.

Looking at mail_user_filter_edit.php, it seems like if we take this:
Code:
		if($this->dataRecord["action"] == 'move') {
		
			$content .= "
`test -e ".'$DEFAULT/.'.$this->dataRecord["target"]."`
if ( ".'$RETURNCODE'." != 0 )
{
  `maildirmake -f ".$this->dataRecord["target"].' $DEFAULT'."`
  `chmod -R 0700 ".'$DEFAULT/'.$this->dataRecord["target"]."`
  `echo INBOX.".$this->dataRecord["target"]." >> ".'$DEFAULT'."/courierimapsubscribed`
}
";		
		}
and change it to something like this :
Code:
               $WhatIsMyTarget = $this->dataRecord["target"]
		if($this->dataRecord["action"] == 'move') {
		
			$content .= "
`test -e ".'$DEFAULT/.'.$WhatIsMyTarget."`
if ( ".'$RETURNCODE'." != 0 )
{
  `maildirmake -f ".$WhatIsMyTarget.' $DEFAULT'."`
  `chmod -R 0700 ".'$DEFAULT/'.$WhatIsMyTarget."`
  `echo INBOX.".$WhatIsMyTarget." >> ".'$DEFAULT'."/courierimapsubscribed`
}
";		
		}
Then the spacing in the folder names should work. That all depends on whether the information in the nabble.com link works, and using a variable overcomes the spacing.
Reply With Quote
  #6  
Old 8th July 2009, 08:49
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,486
Thanks: 813
Thanked 5,255 Times in 4,121 Posts
Default

This will not work as $this->dataRecord["target"]
is also a variable like $WhatIsMyTarget, so your code does the same then the original code. I guess you mixed up that $this->dataRecord["target"] and $WhatIsMyTarget are variables interpreted and replaced by PHP when the code of the form is executed and they are not variables inerpreted by maildrop like $DEFAULT.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #7  
Old 8th July 2009, 14:31
Rescue9 Rescue9 is offline
Member
 
Join Date: Jun 2007
Posts: 52
Thanks: 4
Thanked 3 Times in 2 Posts
Default

Till.... makes sense. What happens if we move the " $WhatIsMyTarget = $this->dataRecord["target"] " line into the $content section as such:

Code:
              
		if($this->dataRecord["action"] == 'move') {
		
			$content .= "
 $WhatIsMyTarget = $this->dataRecord["target"]
`test -e ".'$DEFAULT/.'.$WhatIsMyTarget."`
if ( ".'$RETURNCODE'." != 0 )
{
  `maildirmake -f ".$WhatIsMyTarget.' $DEFAULT'."`
  `chmod -R 0700 ".'$DEFAULT/'.$WhatIsMyTarget."`
  `echo INBOX.".$WhatIsMyTarget." >> ".'$DEFAULT'."/courierimapsubscribed`
}
";		
		}
This way the $WhatIsMyTarget variable will be interpreted by maildrop instead of being interpreted by php, right? Also, I'm sure that my ' & " are so screwed up. If you could write the $WhatIsMyTarget variable as the $DEFAULT variable is written then it should be interpreted by maildrop. If not, how do we get the variable interpreted by maildrop instead of being interpreted by php?

I'm going to try loading up the ISP3 server today and changing the .mailfilter file manually to see if this even works.

Last edited by Rescue9; 8th July 2009 at 14:34.
Reply With Quote
  #8  
Old 9th July 2009, 02:04
Rescue9 Rescue9 is offline
Member
 
Join Date: Jun 2007
Posts: 52
Thanks: 4
Thanked 3 Times in 2 Posts
Default

Ok, after much trial and error from a complete php noob, I've figured a few things out.

First, I have verified that using a $variable inside the .mailfilter file works. I stripped out quite a bit of the .mailfilter file as follows:
Code:
### BEGIN FILTER_ID:2

if (/^Subject:.*\[BGTEditors\]/:h)
{
myfolder = "$DEFAULT/.Yahoo Groups.BGTEditors/"
exception {
to $myfolder
}
}
### END FILTER_ID:2
Assigning myfolder must happen without $. Trying to assign it as $myfolder breaks it. Also, the $DEFAULT/.Yahoo Groups.BGTEditors/ MUST be wrapped in quotes. Not having these also breaks it.

Now, not knowing how ISPConfig writes these rules, I can only assume that having multiple rules with only 1 $myfolder would break things. I plan on changing this variable to [filter_id]EndFolder as such; 2EndFolder. As each FilterID is unique, this should help avoid variables being named the same.

Right now, I'm working on modifying the mail_user_filter_edit.php to write the .mailfilter as above. I'll work on changing the variable later.
Reply With Quote
  #9  
Old 9th July 2009, 04:38
Rescue9 Rescue9 is offline
Member
 
Join Date: Jun 2007
Posts: 52
Thanks: 4
Thanked 3 Times in 2 Posts
Default

Ok... here's a dirty little fix for the folder name problem.
Code:
                if($this->dataRecord["action"] == 'move') {
                        $content .= 'EndFolder = "$DEFAULT/.' . $this->dataRecord['target'] . '/"' . "\n";
                        $content .= "to " . '$EndFolder' . "\n";
                } else {
                        $content .= "to /dev/null\n";
                }
I've tested it various times, and it seems to work properly if the folder is already created. I'm pretty sure it's not going to work if the folder doesn't exist as creating a folder with spaces in the name seems like it could be a problem in itself.

I'm whipped... mind is frazzled. I'll post to bugtracker also. I know it's going to take a bit more work to make it stable. Still hoping someone else will take my ideas and run with them.
Reply With Quote
The Following 2 Users Say Thank You to Rescue9 For This Useful Post:
falko (9th July 2009), till (9th July 2009)
  #10  
Old 10th July 2009, 22:00
Rescue9 Rescue9 is offline
Member
 
Join Date: Jun 2007
Posts: 52
Thanks: 4
Thanked 3 Times in 2 Posts
 
Default

Changed it around a bit more so that the variables are unique. Something didn't work right when I tried it last night though. All the emails went to the last box in the .mailfilter file. I think I may have screwed things up by manually deleting the .mailfilter file and messing up sections of the db.

Anyway, here's the final code for mailbox's that have CREATED folders with spaces. Once again, this is likely not to work with folders that need creating by the script. I'll work on that at a later date, or the devs can modify this to suit their needs. I'm going to completely reinstall and verify operation.


Code:
                if($this->dataRecord["action"] == 'move') {
                        $content .= 'ID' . "$this->id" . 'EndFolder = "$DEFAULT/.' . $this->dataRecord['target'] . '/"' . "\n";
                        $content .= "to ". '$ID' . "$this->id" . 'EndFolder' . "\n";
                } else {
                        $content .= "to /dev/null\n";
                }

                $content .= "}\n";
                $content .= "}\n";
Reply With Quote
The Following User Says Thank You to Rescue9 For This Useful Post:
till (11th July 2009)
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix problem and few questions Gimly Installation/Configuration 12 7th July 2009 16:27
Postfix + postfixadmin = SMTP errors... Rashef Server Operation 4 25th June 2009 16:12
just the last step...and it works. Postfix...need help config. ubuntusr Installation/Configuration 1 5th January 2009 09:50
Problem with dcc-client installation (Postfix) swap-as Installation/Configuration 9 18th September 2008 20:47
Apache2 Freezes celtic Server Operation 31 28th May 2007 17:18


All times are GMT +2. The time now is 18:11.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.