一、SMTP发信认证
通过sasl库中的saslauthd服务实现SMTP认证 二、部署
1.先安装postifx略 2.生成sasl配置文件,实现使用sasl认证vim /usr/lib64/sasl2/smtpd.conf //编写sasl配置文件
pwcheck_method:saslauthd
vim /etc/sysconfig/saslauthd //将sasl验证方式改为系统用户密码验证
将MECH=pam改为MECH=shadow
/etc/init.d/saslauthd restart
chkconfig --level 35 saslauthd on
chkconfig --list saslauthd
testsaslauthd -u hehe -p 123
3.编辑postfix配置文件vim /etc/postfix/main.cf queue_run_delay = 3s
minimal_backoff_time = 3s
maximal_backoff_time = 6s
maximal_queue_lifetime = 12s
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
mynetworks = 127.0.0.1
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
4.验证/etc/init.d/postfix restart //重启邮件服务
客户端telnet测试
telnet mail.xueluo.org 25
EHLO mail.xueluo.org
AUTH LOGIN
askw^&
783jhs2
MAIL FROM:hehe@xueluo.org
RCPT TO:haha@xueluo.org
DATA
aaaaaaa
.
三、Web界面发收邮件
web端软件可自行选择,这里使用squirrelmail,下载http://www.squirrelmail.org/ 1.解压squirrelmailtar -zxvf squirrelmail-webmail-1.4.22.tar.gz -C /usr/src/ //解压squirrelmail
yum -y install httpd php
cp -r /usr/src/squirrelmail-webmail-1.4.22/* /var/www/html/ //拷贝目录下的文件到Apache的网页目录
chown -R apache:apache /var/www/html/
2.配置mv /var/www/html/config/config_default.php /var/www/html/config/config.php
vim /var/www/html/config/config.php
118 $domain = 'xueluo.org';
146 $smtpServerAddress = '192.168.1.10';
202 $imapServerAddress = '192.168.1.10';
212 $popServerAddress = '192.168.1.10';
213 $popPort = 110;
259 $smtp_auth_mech = 'login';
mkdir -p /var/local/squirrelmail/data/
chown apache:apache /var/local/squirrelmail/data/
/etc/init.d/httpd start && chkconfig --level 35 httpd on
3.访问浏览器 --> 192.168.1.10 -->输入用户名密码登录-->使用
四、设置postfix邮件附件大小
1. 修改/etc/php.inimax_execution_time = 30 //改为60 (增加处理脚本的时间限制)
memory_limit = 8M //改为50M (这样才能发10M的附件)
post_max_size = 2M //改为50M
upload_max_filesize = 2M //改为50M
2. 修改/etc/postfix/main.cfmessage_size_limit = 20480000
postfix的默认值是10M, 但这指的是邮件正文和编码后附件的总和, 经过base64编码,附件的大小会增加35%左右, 因此这里设定可接受邮件的大小为20M 可以使用如下命令查看postfix的有关设定: #/usr/sbin/postconf | grep size 3. 修改/var/www/extsuite/extmail/webmail.cfSYS_MESSAGE_SIZE_LIMIT = 51200000
|