Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 5th January 2012, 21:05
ethraza ethraza is offline
Junior Member
 
Join Date: Jan 2012
Posts: 6
Thanks: 0
Thanked 1 Time in 1 Post
Exclamation Email copy and forward problem

Hi. I'm using ISPConfig 3.0.4.1 with postfix and maildrop on a Ubuntu LTS Server production environment and I'm facing a LOT of problens concerning the email copy feature.

Don't matter if I use "Send copy to" direct to the Destionation Email or if I "Send copy to" a Email Forward email, in both cases the same problens happens.

First case:
a@dom.com <Send copy to> b@dom.com

What happens:
1- a@ reach it's quota limit
2- Everytime postfix try to delivery a email to a@, in the mail.log we will see "Permission denied maildrop: maildir over quota."
3- A copy of this email is sent over to b@
4- Now b@ have a bunch of duplicated emails and they will keep coming till someone clean a@ inbox.

There is a way to "fix" that?
I mean, b@ should receive only a copy of the first attenpt or at least a copy of the delivered email, not the denied ones.



Second case:
a@dom.com <Send copy to> cc.a@dom.com (Email forward one)
cc.a@dom.com <Forward a copy to> b@dom.com, c@dom.com, d@dom.com
b@dom.com <Send copy to> x@dom.com
c@dom.com <Send copy to> x@dom.com
d@dom.com <Send copy to> x@dom.com

What happens:
1- a@ got a new mail
2- A copy goes to cc.a@
3- cc.a@ forwards a copy to b@, c@ and d@
4- b@ send a copy to x@
5- c@ send a copy to x@
6- d@ send a copy to x@
7- x@ got 3 new duplicated emails

I believe that a copied email must stop in his first destination and not spread to the entire chain. The way postfix do when we add more destinations to the virtual file, like in:
a@dom.com usrA, usrB, usrC
b@dom.com usrB, usrX
c@dom.com usrC, usrX
...

There is a way to "fix" that spread behavior of ispconfig?


Thanks for any help.
Reply With Quote
Sponsored Links
  #2  
Old 22nd May 2012, 23:03
dar_ek dar_ek is offline
Junior Member
 
Join Date: Oct 2010
Posts: 17
Thanks: 1
Thanked 3 Times in 2 Posts
Default

Quote:
Originally Posted by ethraza View Post
First case:
a@dom.com <Send copy to> b@dom.com

What happens:
1- a@ reach it's quota limit
2- Everytime postfix try to delivery a email to a@, in the mail.log we will see "Permission denied maildrop: maildir over quota."
3- A copy of this email is sent over to b@
4- Now b@ have a bunch of duplicated emails and they will keep coming till someone clean a@ inbox.

There is a way to "fix" that?
One of solve is to remember what mail we send to CC.
To do this we must generate to ".mailfilter" not only this line:
Code:
cc "!user@domain.com"
(that actually ISPconfig do)
but eg. this code:

Code:
USER=tolower("$3")
HOST=tolower("$4")
`reformail -D 8000 /var/vmail/mailfilters/$HOST/$USER/.duplicate.cache`
if ( $RETURNCODE != 0 )
        cc "!user@domain.com"
reformail is a part of courier-maildrop package. -D option do a "Detecting duplicate messages". Thats means that ID's of messages thats already was send (and notified in our .duplicate.cache file are detected and does not resend (cc) on re-queue.

Patch ISPconfig /usr/local/ispconfig/server/plugins-available/maildrop_plugin.inc.php file:

Change line:
Code:
$mailfilter_content .= "cc \"!".$data["new"]["cc"]."\"\n";
To this part:

Code:
                     $mailfilter_content .= "USER=tolower(\"\$3\")\n";
                     $mailfilter_content .= "HOST=tolower(\"\$4\")\n";
                     $mailfilter_content .= "`reformail -D 8000 /var/vmail/mailfilters/\$HOST/\$USER/.duplicate.cache`\n";
                     $mailfilter_content .= "if ( \$RETURNCODE != 0 )\n";
                     $mailfilter_content .= "\tcc \"!".$data["new"]["cc"]."\"\n";
(and recreate CC file if already exists)
Maybe Till do this in distro?

regards.

Last edited by dar_ek; 22nd May 2012 at 23:15.
Reply With Quote
  #3  
Old 29th May 2012, 22:34
ethraza ethraza is offline
Junior Member
 
Join Date: Jan 2012
Posts: 6
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi dar_ek.

Thank you so much for your reply.
Today I tested you implementation but it didn't work. I tested booth, 1st and 2nd cases and the duplicated emails just keep coming.

I edited the .mailfilter of my test accounts and added you modifications to the cc line. Maybe I missunderstand something, but just that didn't made any difference other than a message Id been added to the .duplicate.cache for each incoming email.

If you have any other ideas I can gladly try.

Thanks
Reply With Quote
  #4  
Old 30th May 2012, 13:07
dar_ek dar_ek is offline
Junior Member
 
Join Date: Oct 2010
Posts: 17
Thanks: 1
Thanked 3 Times in 2 Posts
 
Default

hmmm It worked for me

Ok, lets do a step by step once again.

If we fill "Send copy to" field in ISPCOnfig panel, when ISPC generate file: /var/vmail/mailfilters/DOMAIN/USER/.mailfilter with line:

Quote:
cc "!FORWARDTO@DOMAIN.COM"
I modify this to that code:

Quote:
#------ get a mailto parts USER@HOST from maildrop enviroment ($3 and $4)
USER=tolower("$3")
HOST=tolower("$4")
#------ I need this to have separate .duplicate.cache file for every users
#------ reformail save ID from mail and return 0 if that mail was in this file already
`reformail -D 8000 /var/vmail/mailfilters/$HOST/$USER/.duplicate.cache`
#------ in other case (file wasn't in .dupicate.cache)
if ( $RETURNCODE != 0 )
cc "!FORWARDTO@DOMAIN.COM"
#------ do a "Send copy to"
#IN OTHER CASE DO NOT CC but only try to put mail to original mailbox (without cc)
of course you must modify "cc "!FORWARDTO@DOMAIN.COM"" to your case.

If you have generated ".duplicate.cache" file you have reformail command, and it works.

Maybe we misunderstand.
I do that a protects from sending CC for every TRY to put SAME mail in mailbox that is overquota.
But FIRST try of try will DO a CC. And for every (different) new mail that will (try) arrive to mailbox will be a CC too.
Only RESEND SAME mail from postfix queue to original (overquota) mailbox will not generate NEW CC to "Send copy to" user.

ps. if it will works however for you too, you need patch ISPC "plugins-available/maildrop_plugin.inc.php" file, in order to ISPC generate improvement ".mailfilter" each time user fill "Send copy to" in panel (how do this, I wrote in first reply).
Reply With Quote
Reply

Bookmarks

Tags
ispconfig 3, maildrop, postfix

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
Temporarily forward email without keeping a copy second_timothy General 1 7th June 2011 09:02
ISPConfig3 | Email forward Hans General 2 17th March 2010 18:42
email forward setup problem Arseny Installation/Configuration 5 26th January 2010 13:06
Email Forward check box to Leave a copy... elchequimbiri Feature Requests 0 10th September 2009 17:28
How to forward and leave a copy email on a maildir. Olgierd General 1 20th August 2009 09:17


All times are GMT +2. The time now is 00:37.


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