本教程不使用mysql存储用户名和密码,只作为smtp服务,

需要安装dns,详情见 点击打开链接http://blog.csdn.net/zhidao_wenge/article/details/69982350

一、安装软件:

yum install postfix

yum install cyrus*

不卸掉下面两个会报错(因为不使用mysql)

rmp -e cyrus­sasl­ldap 

rmp -e cyrus­sasl­sql

二、编辑配置文件

编辑:/etc/postfix/main.cf (详情介绍 点击打开链接, 点击打开链接

queue_directory = /var/spool/postfixcommand_directory = /usr/sbindaemon_directory = /usr/libexec/postfixdata_directory = /var/lib/postfixmail_owner = postfix myhostname = test01v.jira.netmydomain = jira.commyorigin = $mydomaininet_interfaces = all local_recipient_maps = unknown_local_recipient_reject_code = 550mynetworks = 10.0.0.0/24 alias_maps = hash:/etc/aliasesalias_database = hash:/etc/aliases home_mailbox = Maildir/ smtpd_banner = $myhostname ESMTP unknow debug_peer_level = 2  debugger_command =	 PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin	 ddd $daemon_directory/$process_name $process_id & sleep 5 sendmail_path = /usr/sbin/sendmail.postfix newaliases_path = /usr/bin/newaliases.postfix mailq_path = /usr/bin/mailq.postfix setgid_group = postdrop html_directory = no manpage_directory = /usr/share/mansample_directory = /usr/share/doc/postfix-2.6.6/samplesreadme_directory = /usr/share/doc/postfix-2.6.6/README_FILES #增加以下smtpd_sasl_auth_enable = yessmtpd_sasl_local_domain = $myhostnamesmtpd_sasl_security_options = noanonymoussmtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated, reject_unauth_destination

编辑:vim /etc/sasl2/smtpd.conf (详情介绍点击打开链接

pwcheck_method: auxprop
auxprop_plugin: sasldb
mech_list: plain login CRAM-MD5 DIGEST-MD5
log_level: 3

编辑:vim /etc/sysconfig/saslauthd

SOCKETDIR=/var/run/saslauthd#MECH=pamFLAGS=sasldb

三、修改权限和启动

chmod 755 /etc/sasldb2

service postfix restart

service saslauthd restart

service cyrus-imapd restart

日志 在 /var/log/message 和 /var/log/mailsend  可以查看

四、修改

alternatives –display mta  可以查看默认发邮件程序,如果不是/usr/sbin/sendmail.postfix,可以用个下面命令修改

alternatives –config mta

五、增加用户


saslpasswd2 -c -u `postconf -h mydomain`  test

会让输入两次密码,会产生test@mydomain,安装之前的配置会产生 test@jira.com

查看用户名:sasldblistusers2

六、测试:(详情见:点击打开链接)

(echo -n xxx | openssl base64 -a      会输出xxx的64位编码)telnet测试用base64加密

telnet 127.0.0.1 25

AUTH LOGIN # 后面依次输入 test@jira.com 和密码的  base64加密信息

如果验证 成功了,其他服务器可以连接改smtp,进行发邮件了

https://blog.csdn.net/zhidao_wenge/article/details/69990218

Leave a Reply

Your email address will not be published. Required fields are marked *