Warning: Undefined array key "cperpage" in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 230

Warning: Undefined variable $output in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 300

Warning: Undefined variable $fixed_tags in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 301

Warning: Undefined variable $isshowdots in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 302

Warning: Undefined variable $tag_aditional in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 305

Warning: Undefined variable $tag_aditional in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 308

Warning: Undefined variable $tag_aditional in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 311

Warning: Undefined variable $post in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 320

Warning: Attempt to read property "ID" on null in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 320

Warning: Undefined variable $post in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 320

Warning: Attempt to read property "ID" on null in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 320

Warning: Undefined variable $more_text_link in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 320
Sendmail邮件队列的管理 – 理想社会

Sendmail邮件队列的管理

S

1、队列文件通常存放在/var/spool/mqueue下面,每个待发送的邮件由几个文件构成,例如,我们可以看到下面的目录文件列表:

[root@mail mqueue]# ls

dfRAA27175 xfAAA00733 xfBAA00819 xfEAA32763 xfXAA00706

qfRAA27175 xfAAA00784 xfDAA01360 xfFAA01616

文件名字总是由一个两字符的前缀加上一个随机数字。前缀有四种:

df:邮件内容

qf:邮件头和一些控制信息

xf:一些临时文件

tf:qf文件的临时存储文件

2、可以通过看队列中的qf文件来确定当前队列信息,不过通常都可以用mailq程序来完成对队列状态的查询:

root@mail mqueue]# mailq

Mail Queue (1 request)

–Q-ID– –Size– —–Q-Time—– ————Sender/Recipient———– –

RAA27175 22429 Fri Feb 25 17:34

: deferred)

×××@×××.net

这表示队列中目前只有一封信,由zhangfl发出,[url=mailto:收信人是×××@×××.net]收信人是×××@×××.net]。

3、查看队列:

mailq
# 查看MTA队列的滞留情况(等价于sendmail -bp)

mailq -Ac # 查看MSP队列的滞留情况(等价于sendmail -bp -Ac)

强制送信:

/usr/sbin/sendmail -q -v
# 对MTA队列强制送信

/usr/sbin/sendmail -q -v -Ac
# 对MSP队列强制送信

注:如执行完以上命令后,队列中仍然还有很多邮件,这时需要多次执行以上命令,直到邮件发送完为止。

参数说明:

-q 立即处理队列的内容.

-v 显示进度详细信息

-Ac 读取MSP队列(默认是读取MTA队列)

4、sendmail接受到的信件在用户取走之前将暂时存储在/var/spool/mail目录下面,存储的方法非常简单,就是每个有待读邮件的用户一个文件:

[root@mail spool]# ls -l /var/spool/mail |more

total 19364

-rw-rw—- 1 anyi mail 7559035 Feb 28 22:04 anyi

-rw-rw—- 1 baixuan mail 514 Nov 7 01:32 baixuan

-rw-rw—- 1 cwc mail 515 Feb 28 08:35 cwc

如果一个用户有多封电子邮件,那么这些邮件就被简单地连接在一起构成一个大文件(所以你会看到非常巨大的邮件文件)。

5、如果你面对的是一个很庞大的邮件服务系统,有时会在某个邮件队列中拥塞太多的消息,你可能想把这个队列暂停并且在网络空闲的时候再发送,暂停一个邮件队列的办法非常简单,就是将/var/spool/mqueue目录移走:

killall sendmail

mv /var/spool/mqueue /var/spool/mqueue.stop

mkdir /var/spool/mqueue

sendmail –bd

当网络空闲的时候,可以用-oQ参数立即处理拥塞的队列:

sendmail –oQ/var/spool/mqueue.stop –q

6、设置邮件队列间隔

守护程序启动时 -q 标志的值确定 sendmail 守护程序处理邮件队列的时间间隔。

在 Red Hat 的预设条件中,在 /var/spool/mqueue 当中的信件会每隔 60 分钟由 Sendmail 尝试重新传送一次到目的地去!这个尝试的时间是可以改变的!可以利用 sendmail 的指令或者直接修改 /etc/sysconfig/sendmail 里面的『QUEUE=时间』来修订!例如,如果你想要让 Sendmail 每隔 30 分钟就帮你尝试传送 /var/spool/mqueue 里面的未寄出的信件时,那么就将 /etc/sysconfig/sendmail 这个档案里面的『QUEUE=1h 』改成『QUEUE=30m 』即可!

这些变化会在下一次系统重新启动时生效。如果您想让这些变化立刻生效,请停止并重新启动 sendmail 守护程序,指定新的 -q 标志值。更多相关信息,请参阅停止 sendmail 守护程序和启动 sendmail 守护程序。

7、在sendmail里如何控制邮箱大小

在 /etc/sendmail.cf 中设置

找这个字段,把前面的注释“#”去掉,再把“0”修改为你想要控制的邮件大小,比如10M,这个文件中,是以字节为单位的。

# maximum message size

#O MaxMessageSize=1000000

8、要察看邮件系统的状态,使用mailstats命令。

About the author

Add comment

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

By now163

Your sidebar area is currently empty. Hurry up and add some widgets.