postfix安裝和簡單配置
一,安裝:
[root@station10 ~]# yum install -y postfix
二,postconf工具介紹
Display defaults: postconf -d
Display current non-default settings: postconf -n
Modify main.cf:postconf -e key=value
Show supported map types: postconf -m
三,Incomming Postfix Configuration
修改/etc/postfix/main.cf檔案
1,監聽所有埠:
inet_interfaces = all
2,specify each name and alias by which the server may be referred (監聽主機)
mydestination = $myhostname,localhost,mydomain,localhot,$mydomain
3,把預設的配置inet_interfaces = localhost 修改成:
inet_interfaces = all
4,監聽主機預設可以不用改。
四,outgoing postfix configuration
配置/etc/postfix/main.cf檔案
myorigin = $mydomain
masquerade_exceptions = root
此次配置成:
myorigin = $myhostname
masquerade_exceptions = root
測試上面兩步:
5,station10用的是postfix傳送到郵件,station12是用sendmail接收的。
station10傳送郵件:
[root@station10 ~]# mail
Subject: test
postfix
.
Cc:
[root@station10 ~]#
station12接收郵件:
[root@station12 ~]# mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/root": 1 message 1 new
>N 1 Wed Oct 22 08:13 15/629 "test"
& 1
Message 1:
From Wed Oct 22 08:13:25 2008
To:
Subject: test
Date: Wed, 22 Oct 2008 01:00:25 +0800 (CST)
From: (root)
postfix
& q
Saved 1 message in mbox
[root@station12 ~]#
6,更改outgoing postfix 配置:
此次配置成:
myorigin = $mydomain
masquerade_exceptions = root
測試傳送:
[root@station10 ~]# mail
Subject: test
myorigin
.
Cc:
[root@station10 ~]#
接收檢視資訊:
[root@station12 ~]# mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/root": 1 message 1 new
>N 1 Wed Oct 22 08:19 15/600 "test"
& 1
Message 1:
From Wed Oct 22 08:19:01 2008
To:
Subject: test
Date: Wed, 22 Oct 2008 01:06:00 +0800 (CST)
From: (root)
myorigin
& q
Saved 1 message in mbox
[root@station12 ~]#
五,inbound postfix aliases
1,本地別名配置和sendmail配置一樣,都是修改/etc/aliases檔案
如果讓修改直接生效,執行:
[root@station10 ~]# postalias /etc/aliases
2,虛擬配置:
(1),編輯/etc/postfix/mail.cf檔案
virtual_alias_maps = hash:/etc/postfix/virtual
(2),/etc/postfix/mail.cf的格式和sendmail一樣
(3),rehash the file: postmap /etc/postfix/virtual
3, 實際配置:
(1),在/etc/postfix/mail.cf檔案末尾新增:
virtual_alias_maps = hash:/etc/postfix/virtual
(2), 在/etc/postfix/virtual檔案末尾新增:
(3),[root@station10 ~]# postmap /etc/postfix/virtual
4, 測試:
本地別名測試:
[root@station10 ~]# mail xxx
Subject: test
send to xxx
.
Cc:
[root@station10 ~]# mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/root": 1 message 1 unread
>U 1 Wed Oct 22 01:34 15/487 "test"
& 1
Message 1:
From Wed Oct 22 01:34:57 2008
X-Original-To: xxx
Delivered-To:
To:
Subject: test
Date: Wed, 22 Oct 2008 01:34:57 +0800 (CST)
From: (root)
send to xxx
& q
Saved 1 message in mbox
[root@station10 ~]#
虛擬別名測試:
[root@station10 ~]# mail
Subject: test
send to station10.example.com
.
Cc:
[root@station10 ~]#
在另外一臺機器上收到郵件:
[root@station12 ~]# mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/root": 2 messages 2 new
>N 1 Wed Oct 22 08:43 15/609 "test"
N 2 Wed Oct 22 08:49 15/651 "test"
& 2
Message 2:
From Wed Oct 22 08:49:10 2008
To:
Subject: test
Date: Wed, 22 Oct 2008 01:36:09 +0800 (CST)
From: (root)
send to station10.example.com
& q
Saved 1 message in mbox
Held 1 message in /var/spool/mail/root
[root@station12 ~]#
六,outbound address rewriting
1, Enable in /etc/postfix/main.cf
smtp in the key name indicates SMTP only (not LMTP)
smtp_generic_maps = hash:/etc/postfix/generic
2, define in /etc/postfix/generic
3,Rehash the file: postmap /etc/postfix/generic
測試:
[root@station10 ~]# mail
Subject: test
from to station12.example.com
.'
.
Cc:
[root@station10 ~]#
[root@station12 ~]# mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/root": 2 messages 1 new 2 unread
U 1 Wed Oct 22 08:43 16/619 "test"
>N 2 Wed Oct 22 09:04 16/621 "test"
& 2
Message 2:
From Wed Oct 22 09:04:55 2008
To:
Subject: test
Date: Wed, 22 Oct 2008 01:51:53 +0800 (CST)
From: (root)
from to station12.example.com
.'
& q
Saved 1 message in mbox
Held 1 message in /var/spool/mail/root
[root@station12 ~]#
七,Postfix SMTP Restrictions
1,Create /etc/postfix/access
untagged version of Sendmail access file
rehash using postmap /etc/postfix/access
2,Edit main.cf
smtpd_TAG_restrictions =
check_TAG_access hash:/etc/postfix/access,...
TAG is one of sender,recipient,or client
Example:
smtpd_recipient_restrictions =
check_recipient_access hash:/etc/postfix/access,permit_mynetworks,reject_unauth_destination
八,postfix Operation
main.cf settings
Server names:mydestination must contain server's name and aliases
Listning interfaces:inet_interfaces = all
Archive all messages:always_bcc = address
View SMTP exchange: mail -v
檢視佇列:postqueue -p
清空佇列:postqueue -f
日誌資訊:tail -f /var/log/maillog
例子:
[root@station10 ~]# postqueue -p
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
865B8306C9 101 Wed Oct 22 01:25:43 root
xxx
76670306C8 156 Wed Oct 22 01:24:15 root
-- 0 Kbytes in 2 Requests.
[root@station10 ~]# postqueue -f
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/312079/viewspace-1012222/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 簡單配置PostFix伺服器伺服器
- Elasticsearch 的安裝和簡單配置Elasticsearch
- Postfix 安裝
- postfix安裝
- webpack(簡單安裝配置)Web
- 簡單安裝配置lighttpdhttpd
- 在 windows 下安裝和簡單配置 trac 0.12Windows
- Django安裝與簡單配置(1)Django
- 如何在 CentOS 8 上安裝和配置 Postfix 郵件伺服器CentOS伺服器
- Docker安裝和簡單使用Docker
- saltstack的安裝與簡單配置(一)
- linux 下postfix安裝Linux
- MySQL的簡單安裝配置(免安裝zip版,版本5.7.21)MySql
- pyenv的安裝和簡單使用
- Ubuntu 安裝mysql和簡單操作UbuntuMySql
- LInux簡單安裝和命令Linux
- postfix按指定路徑安裝
- linux_aix安裝postfixLinuxAI
- InnoSetup簡單教程一,安裝使用和簡單測試
- jenkins簡單安裝及配置(Windows環境JenkinsWindows
- TS3AudioBot的簡單安裝配置S3
- PostgreSQL_FDW_安裝和簡單使用SQL
- mysql的安裝和簡單的操作MySql
- Webpack4 學習筆記 - 01:webpack的安裝和簡單配置Web筆記
- mysql 簡單安裝MySql
- iTerm 2 上簡單安裝 Fish 並配置主題
- Qmail系統的安裝、簡單配置及使用(轉)AI
- ideaIU的簡單安裝和啟用IdeaAI
- zabbix安裝—–nginx安裝和配置Nginx
- 11. Oracle for Linux安裝和配置——11.2. Linux安裝和配置——11.2.1. 簡介OracleLinux
- 2.Python及Pycharm的安裝與簡單配置PythonPyCharm
- EMC CLARiiON CX4-120 簡單安裝配置
- 安裝和配置Drupal 8教程,如何安裝和配置Drupal 8?
- 【原創】Ubuntu安裝和簡單使用初感Ubuntu
- kali簡單安裝docker和docker-composeDocker
- 安裝和配置sendmailAI
- Zookeeper 安裝和配置
- 安裝和配置OCFS