HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=16)
-   -   IMAP Default Folders (http://www.howtoforge.com/forums/showthread.php?t=1147)

themachine 5th November 2005 22:55

IMAP Default Folders
 
I'm trying to find the settings for the default MailDir config (if possible) or does ispconfig just run like a 'mkmaildir' command?

Basically, I was the folders "Drafts" "Sent" "Spam" and "Trash" to exist by default.

falko 6th November 2005 14:23

ISPConfig does not create the folders within Maildir. It just tells Postfix/Sendmail to deliver emails to Maildir, and when the first email arrives, then the folders are created.

But you can use the command maildirmake (see man maildirmake or http://www.die.net/doc/linux/man/man...dirmake.1.html ) to create custom folders. To do this automatically, you can change the function user_insert() in /root/ispconfig/scripts/lib/config.lib.php.

Cirox 6th April 2006 21:23

Hi,

i think about the right code to put into this user_insert() function to set up a subfolder "Virus" and "Spam" in maildir for each user automaticly. But i really dont know how. Can you write down such code to put into at the right place ? Many thanks!

greetings cirox

falko 6th April 2006 22:40

Have a look at
Code:

man maildirmake
It should give you an idea.

Cirox 7th April 2006 09:36

Hi,

ok i have read the man maildirmake, but i only know how to make shared folders an folders/subfolders for each user individually. But for me it will be important that this described subfolders will be made automaticly when mails arrive for each user which is created.

So i dont know how to put in in user_insert().

thanks

greetings cirox

falko 7th April 2006 11:49

Do you have PHP programming knowledge? You could do it with a foreach loop, for example.

Cirox 7th April 2006 15:28

Hi,

i dont have php coding knowledge, thats my problem ....

greetings cirox

falko 8th April 2006 01:53

Have a look at the function user_insert() in /root/ispconfig/scripts/lib/config.lib.php. Somewhere around line 702 you could add something like this:

PHP Code:

if($mod->system->server_conf["use_maildir"]){
  
exec("maildirmake ...");



Cirox 30th April 2006 11:07

Hi,

i cant solve the problem, here is the code around line 702:

Code:

// User-Mail-Datei anlegen, sonst evtl. Fehler bei Autoresponder
  if(!$mod->system->server_conf["use_maildir"]){
    if(!is_file("/var/spool/mail/".$user_username)){
      $mod->log->phpcaselog(touch("/var/spool/mail/".$user_username), "create /var/spool/mail/".$user_username, $this->FILE, __LINE__);
      $mod->log->caselog("chown $user_username:mail /var/spool/mail/$user_username &> /dev/null", $this->FILE, __LINE__);
      $mod->log->caselog("chmod 600 /var/spool/mail/$user_username", $this->FILE, __LINE__);
    }
  }

now i want to create automaticly two folders "spam" and "virus" for each new mailbox.

How to put into? Can you change the code, see above?

greetings cirox

falko 30th April 2006 14:27

You would use something like this:

PHP Code:

// User-Mail-Datei anlegen, sonst evtl. Fehler bei Autoresponder
  
if(!$mod->system->server_conf["use_maildir"]){
    if(!
is_file("/var/spool/mail/".$user_username)){
      
$mod->log->phpcaselog(touch("/var/spool/mail/".$user_username), "create /var/spool/mail/".$user_username$this->FILE__LINE__);
      
$mod->log->caselog("chown $user_username:mail /var/spool/mail/$user_username &> /dev/null"$this->FILE__LINE__);
      
$mod->log->caselog("chmod 600 /var/spool/mail/$user_username"$this->FILE__LINE__);
    }
  } else {
    
exec("maildirmake ...");
  } 



All times are GMT +2. The time now is 07:46.

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