Skip to content

Commit b644475

Browse files
committed
[NF] new mail/homedir substitution option
1 parent dccd8b8 commit b644475

File tree

2 files changed

+37
-36
lines changed

2 files changed

+37
-36
lines changed

application/Entities/Mailbox.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,10 @@ public static function substitute( $email, $str )
587587
{
588588
list( $un, $dn ) = explode( '@', $email );
589589

590-
$str = str_replace ( '%u', $un, $str );
591-
$str = str_replace ( '%d', $dn, $str );
592-
$str = str_replace ( '%m', $email, $str );
590+
$str = str_replace ( '%atmail', substr( $email, 0, 1 ) . '/' . substr( $email, 1, 1 ) . '/' . $email, $str );
591+
$str = str_replace ( '%u', $un, $str );
592+
$str = str_replace ( '%d', $dn, $str );
593+
$str = str_replace ( '%m', $email, $str );
593594

594595
return $str;
595596
}
@@ -603,14 +604,14 @@ public static function substitute( $email, $str )
603604
public function setHomedirSize($homedirSize)
604605
{
605606
$this->homedir_size = $homedirSize;
606-
607+
607608
return $this;
608609
}
609610

610611
/**
611612
* Get homedir_size
612613
*
613-
* @return integer
614+
* @return integer
614615
*/
615616
public function getHomedirSize()
616617
{
@@ -626,14 +627,14 @@ public function getHomedirSize()
626627
public function setMaildirSize($maildirSize)
627628
{
628629
$this->maildir_size = $maildirSize;
629-
630+
630631
return $this;
631632
}
632633

633634
/**
634635
* Get maildir_size
635636
*
636-
* @return integer
637+
* @return integer
637638
*/
638639
public function getMaildirSize()
639640
{
@@ -649,14 +650,14 @@ public function getMaildirSize()
649650
public function setSizeAt($sizeAt)
650651
{
651652
$this->size_at = $sizeAt;
652-
653+
653654
return $this;
654655
}
655656

656657
/**
657658
* Get size_at
658659
*
659-
* @return \DateTime
660+
* @return \DateTime
660661
*/
661662
public function getSizeAt()
662663
{
@@ -699,14 +700,14 @@ public static function cleanMaildir( $maildir )
699700
public function setDirectoryEntry(\Entities\DirectoryEntry $directoryEntry = null)
700701
{
701702
$this->DirectoryEntry = $directoryEntry;
702-
703+
703704
return $this;
704705
}
705706

706707
/**
707708
* Get DirectoryEntry
708709
*
709-
* @return \Entities\DirectoryEntry
710+
* @return \Entities\DirectoryEntry
710711
*/
711712
public function getDirectoryEntry()
712713
{
@@ -735,7 +736,7 @@ public function setDeletePending($deletePending)
735736
/**
736737
* Get delete_pending
737738
*
738-
* @return boolean
739+
* @return boolean
739740
*/
740741
public function getDeletePending()
741742
{

application/configs/application.ini.dist

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ resources.doctrine2.connection.options.charset = 'utf8'
5151

5252
;; Doctrine2 requires Memcache for maximum efficency. Without Memcache
5353
;; it can be highly inefficient and will slow page requests down.
54-
;;
54+
;;
5555
;; You are strongly advised to install memcache and comment ArrayCache
5656
;; here and uncomment MemcacheCache.
5757
;;
@@ -64,7 +64,7 @@ resources.doctrine2cache.namespace = 'ViMbAdmin3'
6464

6565
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6666
; Default values used when creating domains
67-
;
67+
;
6868
; See: https://github.com/opensolutions/ViMbAdmin/wiki/Configuration
6969
; See: https://github.com/opensolutions/ViMbAdmin/wiki/Quotas
7070

@@ -121,9 +121,10 @@ defaults.mailbox.gid = 2000
121121
; Set the homedir and maildir values in the mailbox table where the
122122
; following substitutions apply:
123123
;
124-
; %d -> domain part of email address
125-
; %u -> user part of email address
126-
; $m -> full email address
124+
; %d -> domain part of email address
125+
; %u -> user part of email address
126+
; %m -> full email address
127+
; %atmail -> substitutes an email address (test@example.com) with t/e/test@example.com
127128
;
128129
;
129130
; http://wiki2.dovecot.org/VirtualUsers/Home
@@ -136,19 +137,19 @@ defaults.mailbox.min_password_length = 8
136137

137138
; The password hashing function to use. Set to one of:
138139
;
139-
; "plain" - password stored as clear text
140+
; "plain" - password stored as clear text
140141
; "md5" - password hashed using MD5 without salt (PHP md5())
141142
; "md5.salted" - password hashed using MD5 with salt (see below)
142143
; "sha1" - password hashed using sha1 without salt
143-
; "sha1.salted" - password hashed using sha1 with salt defined below
144-
; "crypt:XXX" - call the PHP crypt function (with random salt) where XXX is one of: md5, blowfish, sha256, sha512
145-
; "dovecot:XXX" - call the Dovecot password generator (see next option below) and use the
146-
; scheme specified by XXX. To see available schemes, use 'dovecotpw -l'
144+
; "sha1.salted" - password hashed using sha1 with salt defined below
145+
; "crypt:XXX" - call the PHP crypt function (with random salt) where XXX is one of: md5, blowfish, sha256, sha512
146+
; "dovecot:XXX" - call the Dovecot password generator (see next option below) and use the
147+
; scheme specified by XXX. To see available schemes, use 'dovecotpw -l'
147148
; or 'doveadm pw -l'
148149

149150
defaults.mailbox.password_scheme = "md5.salted"
150151

151-
; The path to (and initial option(s) if necessary) the Dovecot password generator. Typical
152+
; The path to (and initial option(s) if necessary) the Dovecot password generator. Typical
152153
; values may be something like:
153154
;
154155
; "/usr/bin/doveadm pw"
@@ -187,7 +188,7 @@ archive.path = "/srv/archives"
187188

188189
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
189190
; Enable mailbox deletion on the file system
190-
;
191+
;
191192
; See: https://github.com/opensolutions/ViMbAdmin/wiki/Deleting-Mailboxes
192193
;
193194

@@ -196,13 +197,13 @@ mailbox_deletion_fs_enabled = false
196197

197198
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
198199
; Export Mailbox Settings
199-
;
200+
;
200201
; See: https://github.com/opensolutions/ViMbAdmin/wiki/Export-Settings
201202
;
202203
defaults.export_settings.disabled = true
203204

204205

205-
;; Export settings alowed subnets
206+
;; Export settings alowed subnets
206207
defaults.export_settings.allowed_subnet[] = "10."
207208
defaults.export_settings.allowed_subnet[] = "192.168."
208209

@@ -253,10 +254,10 @@ server.webmail.user = "%m"
253254

254255
identity.orgname = "Example Limited"
255256
identity.name = "Example Support Team"
256-
identity.email = "support@example.com"
257+
identity.email = "support@example.com"
257258
identity.autobot.name = "ViMbAdmin Autobot"
258259
identity.autobot.email = "autobot@example.com"
259-
identity.mailer.name = "ViMbAdmin Autobot"
260+
identity.mailer.name = "ViMbAdmin Autobot"
260261
identity.mailer.email = "do-not-reply@example.com"
261262

262263
identity.sitename = "ViMbAdmin"
@@ -274,7 +275,7 @@ server.email.address = "support@example.com"
274275
;;
275276
;; Skinning
276277
;;
277-
;; You can skin ViMbAdmin pages if you wish.
278+
;; You can skin ViMbAdmin pages if you wish.
278279
;;
279280
;; See: https://github.com/opensolutions/ViMbAdmin/wiki/Skinning
280281

@@ -355,12 +356,12 @@ skipInstallPingback = 0
355356

356357

357358
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
358-
; Allow admins to dictate whether a user can use BOTH, IMAP ONLY,
359-
; POP3 ONLY when creating mailboxes.
359+
; Allow admins to dictate whether a user can use BOTH, IMAP ONLY,
360+
; POP3 ONLY when creating mailboxes.
360361
;
361362
; Must be supported by your POP3/IMAP server.
362363
;
363-
; See https://github.com/opensolutions/ViMbAdmin/wiki/POP3-IMAP-Access-Permissions
364+
; See https://github.com/opensolutions/ViMbAdmin/wiki/POP3-IMAP-Access-Permissions
364365
; for documentation.
365366
;
366367
; This is handled via a plugin
@@ -600,7 +601,7 @@ resources.doctrine2cache.autoload_method = "composer"
600601
;resources.doctrine2cache.memcache.servers.0.persistent = false
601602
;resources.doctrine2cache.memcache.servers.0.weight = 1
602603
;resources.doctrine2cache.memcache.servers.0.timeout = 1
603-
;resources.doctrine2cache.memcache.servers.0.retry_int = 15
604+
;resources.doctrine2cache.memcache.servers.0.retry_int = 15
604605

605606
; resources.doctrine2cache.memcache.servers.1.host = 'xxx'
606607
; resources.doctrine2cache.memcache.servers.2.host = 'yyy'
@@ -612,12 +613,12 @@ resources.auth.oss.adapter = "OSS_Auth_Doctrine2Adapter"
612613
resources.auth.oss.pwhash = "bcrypt"
613614
resources.auth.oss.hash_cost = 9
614615
resources.auth.oss.entity = "\\Entities\\Admin"
615-
resources.auth.oss.disabled.lost-username = 1
616+
resources.auth.oss.disabled.lost-username = 1
616617
resources.auth.oss.disabled.lost-password = 0
617618

618619
resources.auth.oss.rememberme.enabled = 1
619620
resources.auth.oss.rememberme.timeout = 2592000
620-
resources.auth.oss.rememberme.secure = true
621+
resources.auth.oss.rememberme.secure = true
621622

622623
resources.auth.oss.lost_password.use_captcha = true
623624

@@ -659,4 +660,3 @@ mini_css = 0
659660
phpSettings.display_startup_errors = 1
660661
phpSettings.display_errors = 1
661662
resources.frontController.params.displayExceptions = 1
662-

0 commit comments

Comments
 (0)