Commit 2a704f6c authored by tbrehm's avatar tbrehm
Browse files

Implemented: FS#891 - Email Forward check box to Leave a copy.

parent a5c46913
......@@ -560,6 +560,7 @@ CREATE TABLE `mail_user` (
`gid` int(11) unsigned NOT NULL default '5000',
`maildir` varchar(255) NOT NULL default '',
`quota` bigint(20) NOT NULL default '-1',
`cc` varchar(255) NOT NULL default '',
`homedir` varchar(255) NOT NULL,
`autoresponder` enum('n','y') NOT NULL default 'n',
`autoresponder_start_date` datetime NOT NULL default '0000-00-00 00:00:00',
......
......@@ -110,6 +110,18 @@ $form["tabs"]['mailuser'] = array (
'width' => '30',
'maxlength' => '255'
),
'cc' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'REGEX',
'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-z]{2,10}){0,1}$/i',
'errmsg'=> 'cc_error_isemail'),
),
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'maildir' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
......
......@@ -37,4 +37,6 @@ $wb["move_junk_txt"] = 'Move Spam Emails to Junk directory';
$wb["name_txt"] = 'Realname';
$wb["name_optional_txt"] = '(Optional)';
$wb['autoresponder_active'] = 'Enable the autoresponder';
$wb['cc_txt'] = 'Send copy to';
$wb['cc_error_isemail'] = 'The "Send copy to" field does not conatin a valid email address';
?>
......@@ -30,6 +30,10 @@
<label for="quota">{tmpl_var name='quota_txt'}</label>
<input name="quota" id="quota" value="{tmpl_var name='quota'}" size="30" maxlength="255" type="text" class="textInput formLengthLimit" /><p class="formInputUnity">&nbsp;MB</p>
</div>
<div class="ctrlHolder">
<label for="name">{tmpl_var name='cc_txt'}</label>
<input name="cc" id="cc" value="{tmpl_var name='cc'}" size="30" maxlength="255" type="text" class="textInput" /> &nbsp; {tmpl_var name='name_optional_txt'}
</div>
<div class="ctrlHolder">
<label for="policy">{tmpl_var name='policy_txt'}</label>
<select name="policy" id="policy" class="selectInput">
......
require ["fileinto", "regex", "vacation"];
<tmpl_if name="cc">
# Send a copy of email to
redirect "<tmpl_var name='cc'>";
keep;
</tmpl_if>
<tmpl_if name="move_junk" op="==" value="y">
# Move spam to spam folder
if header :contains "X-Spam-Flag" "YES" {
......
......@@ -89,7 +89,9 @@ class maildeliver_plugin {
or $data["old"]["autoresponder"] != $data["new"]["autoresponder"]
or (isset($data["new"]["email"]) and $data["old"]["email"] != $data["new"]["email"])
or $data["old"]["autoresponder_start_date"] != $data["new"]["autoresponder_start_date"]
or $data["old"]["autoresponder_end_date"] != $data["new"]["autoresponder_end_date"]) {
or $data["old"]["autoresponder_end_date"] != $data["new"]["autoresponder_end_date"]
or $data["old"]["cc"] != $data["new"]["cc"]
) {
$app->log("Mailfilter config has been changed",LOGLEVEL_DEBUG);
......
......@@ -166,8 +166,10 @@ class maildrop_plugin {
}
// Write the custom mailfilter script, if mailfilter recipe has changed
if($data["old"]["custom_mailfilter"] != $data["new"]["custom_mailfilter"] or
$data["old"]["move_junk"] != $data["new"]["move_junk"]) {
if($data["old"]["custom_mailfilter"] != $data["new"]["custom_mailfilter"]
or $data["old"]["move_junk"] != $data["new"]["move_junk"]
or $data["old"]["cc"] != $data["new"]["cc"]) {
$app->log("Mailfilter config has been changed",LOGLEVEL_DEBUG);
if(trim($data["new"]["custom_mailfilter"]) != '' or $data["new"]["move_junk"] != 'n') {
// Delete the old filter recipe
......@@ -184,6 +186,11 @@ class maildrop_plugin {
$config_file_path = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter';
$mailfilter_content = '';
if($data["new"]["cc"] != '') {
$mailfilter_content .= "cc \"!".$data["new"]["cc"]."\"\n";
}
if($data["new"]["move_junk"] == 'y') {
$mailfilter_content .= file_get_contents($conf["rootpath"].'/conf/mailfilter_move_junk.master')."\n";
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment