LINUX邮件收发
1.一般郵件收發
啟動服務
[root@kittod ~]# systemctl restart postfix修改配置
vim /etc/postfix/main.cf
?修改如下行
94??myhostname = mail.xixi.com
102 mydomain = xixi.com? #本地域名稱
118 myorigin = $mydomain
132 inet_interfaces = all
183 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
283 mynetworks = 192.168.171.0/24, 127.0.0.0/8 #改為本地網段192.168.171.0
發送郵件 [root@kittod ~]# mail redhat@haha.com Subject: test02 這是測試內容 EOT 注:ctrl+d退出寫入?2.群發郵件
/etc/aliases 是別名數據庫
vim /etc/aliases??
在文件末尾添加
qunfa : xixi,maomao,zhangsan #發送給qunfa,xixi,maomao,zhangsan也會受到
xixi:xixi,maomao? #xixi能收到的郵件 maomao也能收到
?發送郵件
[root@kittod ~]# mail qunfa Subject: test 這是測試內容 EOT3.加密郵件收發
在/etc/postfix/下面進行操作
[root@haha ~]# cd /etc/postfix/ [root@haha postfix]# openssl req -new -x509 -nodes -out smtpd.pem -keyout smtpd.pem -days 3650 配置文件/etcpostfix/main.cf #添加到末尾 smtp_use_tls = yes smtpd_use_tls = yes smtp_tls_note_starttls_offer = yes smtpd_tls_key_file = /etc/postfix/smtpd.pem smtpd_tls_cert_file = /etc/postfix/smtpd.pem smtpd_tls_CAfile = /etc/postfix/smtpd.pem smtpd_tls_loglevel = 1 smtpd_tls_received_header = yes smtpd_tls_session_cache_timeout = 3600s tls_random_source = dev:/dev/urandom 修改文件/etc/postfix/master.cf 29 smtps inet n - n - - smtpd 30 # -o syslog_name=postfix/smtps 31 -o smtpd_tls_wrappermode=yes 32 -o smtpd_sasl_auth_enable=yes?重啟服務
[root@haha postfix]# systemctl restart postfix [root@haha postfix]# systemctl restart saslauthd [root@haha postfix]# systemctl restart dovecot4.虛擬別名域
配置文件/etcpostfix/main.cf
virtual_alias_domains = group.com, work.com virtual_alias_maps = hash:/etc/postfix/virtual #添加到末尾 修改虛擬別名域文件/etc/postfix/virtual @group.com? ? ? ? ? ? @baidu.com @work.com? ? ? ? ? ? ? @qq.com 123@group.com? ? ? ?maomao,xixi 234@work.com? ? ? ? ?doudou@work.com,xiaodou@work.com 重新生成虛擬別名域數據庫 [root@mail ~]# postmap /etc/postfix/virtual 重新加載虛擬別名域數據文件 [root@mail ~]# systemctl reload postfix?5.啟用用戶認證收發實驗
安裝相關軟件 [root@kittod ~]# dnf install cyrus-sasl dovecot *sasl* -y?配置文件/etc/postfix/main.cf,添加到末尾
#啟用SASL對客戶端進行認證 broken_sasl_auth_clients = yes #啟用SASL認證 smtpd_sasl_auth_enable = yes #禁用匿名用戶 smtpd_sasl_security_options = noanonymous #定義收件人限定 smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination?修改/etc/dovecot/dovecot.conf
25 protocols = imap pop3 lmtp 50 login_trusted_networks = 192.168.226.0/24 修改?/etc/dovecot/conf.d/10-mail.conf文件 32 mail_location = mbox:~/mail:INBOX=/var/mail/%u?重啟服務
[root@haha postfix]# systemctl restart postfix [root@haha postfix]# systemctl restart saslauthd [root@haha postfix]# systemctl restart dovecot總結
- 上一篇: java实现pdf转word_Java实
- 下一篇: DOSbox汇编集成环境下的具体设置