linux邮件自动回复,debian上 postfix+dovecot+squirrelmail 实现 自动回复
作者:lxq007
本文主要介紹了基于dovecot 的郵件自動回復 的配置過程。
我使用的系統及安裝的軟件包為Debian GNU/Linux 4.0、postfix?2.3.4-3 、squirrelmail?? 1.4.9a-1和
dovecot? 1.0.13-2 。
dovecot 版本如果比較舊的話,配置自動回復時將不能給每個郵件用戶設置文件。
-----------------------------------------------------------------------------------
配置時遇到的一些其他問題: "X-Spam-Flag"等在郵件信頭不顯示
在重新配置郵件服務器時,安裝完amavisd-new和squuirrelmail軟件包后,并在devocot中進行配置。查看郵件日志:
nano /var/log/mail.log
在日志中發現,amavisd生效,對郵件進行了打分,但在登錄squirrelmail前臺后,發現在郵件信頭中不會顯示"X-Spam-Flag"等信頭信息,也就不會將垃圾郵件轉移到indox.spam信箱中去。
經過尋找,終于發現問題原因,原來是由于域名不對,然后進行修改:
nano /etc/mailname
關于在debian上如何安裝配置postfix+dovecot+squirremail+amavisd+spamassassion,請參考
-----------------------------------------------------------------------------------
dovecot中的配置文件:dovecot.conf進行如下修改:
plugin {
sieve =
/home/squirrelmail/data/%u/vacation.txt?????? //添加這行
#sieve =
/home/squirrelmail/%d/%n/vacation.txt???? //添加這行,用于測試
}
自動回復的腳步vacation.txt為:
require
"vacation";
vacation
:days 1
:subject "test1"
"this is
ts.";
redirect t3@xxxxx.cn;
(sieve =
/home/vmail/yumail.cn/t7/sieve?這個為原來的腳步目錄,sieve =
/home/squirrelmail/data/%u/vacation.txt?為courier_vacation插件產生的腳本目錄,courier_vacation源碼進行了修改,這里的vacation.txt??包含了原來的vacation.txt\vacation_subject.txt\vacation_cc_addresses.txt,并且vacation.txt內寫為了腳步形式,如上邊的腳步)
其中%d 代表域名,%n代表用戶文件t*/,%u代表了用戶文件t*@xxxx.cn/
,
這的vacation.txt文件為squirrelmail的插件courier_vacation產生的,由于執行這個腳步要生成一個vacation.txtc(注意此類腳步生成文件均為在本文件名后加"c"),所以在此要注意權限問題。可以:
chmod 777
/home/squirrelmail/data
--------------------------------------------------------------------------------
courier_vacation如何修改:使vacation.txt\vacation_subject.txt\vacation_cc_addresses.txt合而為一并輸出為可執行的腳步?
修改options.php文件:以下為修改部分的代碼
function removeVacationFiles($homeDir)
{
global $messageFileName, $subjectFileName, $ccAddressesFileName,
$keepMessagesFileName;
if (compatibility_check_sm_version(1, 3))
{
include_once (SM_PATH . 'plugins/courier_vacation/config.php');
}
else
{
include_once
('../plugins/courier_vacation/config.php');
}
// delete message text file
//
if (file_exists($homeDir .
'/' . $messageFileName))
{
$FILE = @fopen($homeDir . '/' .
$messageFileName, 'w');
if (!$FILE)
{
showError('ERROR: Could not access vacation message');
exit(1);
}
if (, " "))
{
fclose($FILE);
showError('ERROR: Could not delete vacation
message');
exit(1);
}
fclose($FILE);
}
}
// creates (or overwrites) vacation files as needed
// removes files that
should not be present (for example,
// if there was a subject file
previously, but this
// time no subject is given, the subject file is
removed)
//
function writeVacationFiles($homeDir,
$messageText,
$messageSubject, $ccAddresses,
$keepMessages)
{
global $messageFileName, $subjectFileName,
$ccAddressesFileName, $keepMessagesFileName;
if (compatibility_check_sm_version(1, 3))
{
include_once (SM_PATH . 'plugins/courier_vacation/config.php');
}
else
{
include_once
('../plugins/courier_vacation/config.php');
}
// write message text
//
$msg =
eregi_replace('
', "\n", $messageText);
$FILE = @fopen($homeDir . '/' . $messageFileName, 'w');
exec("sudo chmod
o+w ".$homeDir);
if (!$FILE)
{
showError('ERROR: Could not
access vacation message');
exit(1);
}
$vacation_str =
"require \"vacation\";\n";
$vacation_str .= "vacation\n";
$vacation_str .= "??? :days 1\n";
/*add subject*/
if
(!empty($messageSubject))
{
$vacation_str .= "??? :subject
\"".$messageSubject."\"\n";
}
/*add mailbody*/
if
(empty($msg)) $msg = ' ';? // empty messages really screw things up
$vacation_str .= "\"".$msg."\";\n";
/*add redirect address*/
if (!empty($ccAddresses))
{
// TODO: how can we make sure there
are color: #ff0000;">? $vacation_str .="redirect
\"".$ccAddr."\";\n";
}
// write flag file indicating to keep messages in
this account (if needed)
//
if
(!empty($keepMessages))
{
$vacation_str .="keep;\n";????? }
}
if (,
$vacation_str))
{
fclose($FILE);
showError('ERROR: Could
not save vacation message');
exit(1);
}
fclose($FILE);
}
// displays simple error output page
//
function
showError($message)
{
global $color;
displayPageHeader($color, 'None');
echo
''
. $message
.
'
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的linux邮件自动回复,debian上 postfix+dovecot+squirrelmail 实现 自动回复的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何理解「续航里程是衡量汽车性能的重要指
- 下一篇: 下雨天对车子伤害大吗?车子什么牌子车膜比