#!/bin/bash
yum -y install postfix dovecot;
#/etc/postfix/main.cf
#postfix check postfix start postfix stop postfix flush postfixreload
#/etc/postfix/main.cf
中,行首不可以空白,=号两边都要空白
myhostname = centos7test5
myorigin = $myhostname
inet_interfaces = all
inet_protocols = ipv4
mydestination = $myhostname
mynetworks_style = host
mynetworks = 127.0.0.0/8,192.168.10.0/24,192.168.100.0/24
###
postfix check
#/etc/postfix/access
192.168.10.0 OK
.edu.tw OK
av.com REJECT
192.168.2. REJECT
postmap hash:/etc/postfix/access
#/etc/aliases
root: root,dmtsai
students: std1,std2,std3,std4
postalias hash:/etc/aliases
####
postqueue -p
#####################################pop3
/etc/dovecot/dovecot.conf
protocols = imap pop3
/etc/dovecot/conf.d/10-ssl.conf
ssl = no
dovecot start
##pop3s
cd /etc/pki/tls/certs/
make mydovecot.pem
vim /etc/dovecot/conf.d/10-auth.conf
disable_plaintext_auth = yes
vim /etc/dovecot/conf.d/10-ssl.conf
ssl = required
ssl_cert =
ssl_key =
vim /etc/dovecot/conf.d/10-master.conf
inet_listener imap {
port = 0
}
inet_listener pop3 {
port = 0
}
vim /etc/dovecot/conf.d/10-mail.conf
mail_location = mbox:~/mail:INBOX=/var/mail/%u
dovecot restart
#################################
yum install -y mailx sharutils mutt
uuencode
附件 邮件名| mail -s 'test' root
mutt -a
附件 -i 内容文件 -s 标题E-mail
#
邮件过滤软件postgrey
发送邮件设置
vim /etc/mail.rc
文件尾增加以下内容
set from=1968089885@qq.com smtp="smtp.qq.com"
set smtp-auth-user="1968089885@qq.com"smtp-auth-password="123456"
set smtp-auth=login
说明:
from:
对方收到邮件时显示的发件人
smtp:
指定第三方发送邮件的smtp服务器地址
smtp-auth: SMTP
的认证方式。默认是LOGIN,也可改为CRAM-MD5或PLAIN方式
smtp-auth-user:
第三方发邮件的用户名
smtp-auth-password:
用户名对应密码