iRedmail 用 dovecot sieve ...放在 user 的 sieve 目錄下 

dovecot.sieve 內容 

require ["vacation"];
# rule:[Vacation]
if false # true
{
        vacation :days 1 "I'm on vacation.";
}

 

改成 :  自動回信 ......

require "variables";
require "vacation";

set "subject" "";
if header :matches "subject" "*" {
   set "subject" "${1}";
}

vacation :subject "Auto-Reply msg: ${subject}" text:
Hello,

I am currently on vacation. I'll be gone for six weeks and during that
time I am conveniently unreachable.

Cheers,

echochio
.
;

改成 :  自動回信 ....加入 html  ......

require "vacation";

vacation :subject "感謝您的來信" :mime "Content-Type: text/html;charset=UTF-8
Content-Transfer-Encoding: 7bit

<html>
<body>
<h2>Hello !! 非常感謝您 </h2>
我的 web mail <a href=http://ms1.demo.com> 連結 .....</a>
</body>
</html>";

config  是 ....
用 ; 來做完結 ...那 function 
用 " 來開始及結束 要帶入的資料 
用 : 來區分 變數 
用 { 及 } 來放入 if 中 
所以內容不能用 其他的 字眼 ......
 

官方文件

如果指定和使用“:seconds 0”,則表示發送所有自動回复,並且不嘗試抑制連續的回复。 這不同於基准假期規格,不允許時間段為零(“:第0天”被禁止); 需要更改以允許自動應答器的操作(參見[RFC6133],並且特別注意該文檔的第3節中的示例4)。  如果“:seconds”和“:days”都被省略,則使用站點定義的間隔(參見[RFC5230])。

發現 ....很麻煩 ....加在  /etc/dovecot/dovecot.conf 的 plugin 內 (因內定沒 enable 要加了才 enable)

    sieve_extensions = +vacation-seconds

    # One hour at minimum
    sieve_vacation_min_period = 1s

    # Ten days default
    sieve_vacation_default_period = 36000d

    # Thirty days at maximum
    sieve_vacation_max_period = 36000d

   

dovecot.sieve 內容 改成

require "vacation";
require "vacation-seconds";

vacation :seconds 1 :subject "感謝您的來信" :mime "Content-Type: text/html;charset=UTF-8
Content-Transfer-Encoding: 7bit

<html>
<body>
<h2>Hello !! 非常感謝您 </h2>
我的 web mail <a href=http://ms1.demo.com> 連結 .....</a>
</body>
</html>";


測試時發現 ......同樣主旨及內容的 ....不回信 ....@#$%^&*

找到資料存於 .dovecot.lda-dupes 這檔案中 ....

那寫個 crontab 去刪除  .dovecot.lda-dupes  這檔案就好了 .....

就每分鐘刪除一次 ...不過份吧 .....

修改 roundcubemail  怕 user 去改動到...(我只有用 roundcubemail 沒用其他 web mail)

指定特定 user 拿掉 managesieve
檔案 :  /var/www/roundcubemail/plugins/managesieve/lib/Roundcube/rcube_sieve.php

在
$result = $this->sieve->login($username, $password, $auth_type ? strtoupper($auth_type) : null, $authz);
後面加上 :

        if ($username == "chio@ms1.demo.com"){
          return $this->_set_error(self::ERROR_LOGIN);
        }

 

將檔案/var/www/roundcubemail/plugins/managesieve/config.inc.php
 

在
$config['managesieve_vacation'] = 1;
後面加上 : 

if ($_SESSION['username'] == "chio@ms1.demo.com") {
        $config['managesieve_vacation'] = 0;
}

文章標籤
全站熱搜
創作者介紹
創作者 echochio 的頭像
echochio

echochio

echochio 發表在 痞客邦 留言(0) 人氣(467)