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

.

'

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值