Linux郵件傳輸協議postfix

2021-09-24 12:32:50 字數 4167 閱讀 6088

1、mta:郵件傳輸**,smtp伺服器

sendmail,uucp

單體結構,suid,配置檔案語法(m4編寫)

qmail

postfix:模組化設計,安全,跟sendmail相容,效率高

exim:mta

exchange (windows,非同步訊息協作平台)

2、mda:郵件投遞**

procmail

maildrop

3、mra:郵件檢索協議(pop3、imap4)

cyrus-imap

dovecot依賴mysql客戶端

4、mua:郵件使用者**

outlook express, outlook

foxmail

thunderbird

evolution

mutt(文字介面)

5、postfix的配置檔案

a) postfix模組化:

master: /etc/postfix/master.cf

mail: /etc/postfix/main.cf

b) postconf: 配置postfix

-d: 顯示預設的配置

-n: 修改了的配置

-m: 顯示支援的查詢表型別

-a: 顯示支援的sasl客戶端外掛程式型別

-e parmater=value: 更改某引數配置資訊,並儲存至main.cf檔案中

6、smtp狀態碼:

1xx: 純資訊

2xx: 正確

3xx: 上一步操作尚未完成,需要繼續補充

4xx: 暫時性錯誤

5xx: 永久性錯誤

7、smtp協議命令:

helo (smtp協議)

ehlo (esmtp協議)

rcpt to:郵件送給

8、alias: 郵件別名

[email protected]: [email protected]

9、郵件伺服器:mail server:

smtp:簡單郵件傳輸協議

esmtp:擴充套件smtp協議

pop3:郵局協議

imap4:網際網路郵件訪問協議

uucp:unix主機複製檔案的協議

10、安裝配置postfix

groupadd -g 2525 postfix

useradd -g postfix -u 2525 -s /sbin/nologin -m postfix

groupadd -g 2526 postdrop

useradd -g postdrop -u 2526 -s /sbin/nologin -m postdrop

tar zxvf postfix-2.9.3.tar.gz

cd postfix-2.9.3

make makefiles 'ccargs=-dhas_mysql -i/usr/include/mysql -duse_sasl_auth -duse_cyrus_sasl -i/usr/include/sasl -duse_tls ' 'auxlibs=-l/usr/lib/mysql -lmysqlclient -lz -lm -l/usr/lib/sasl2 -lsasl2 -lssl -lcrypto'

make

make instal

1、生成別名二進位制檔案

newaliases

2、進行一些基本配置,測試啟動postfix

myhostname = mail.magedu.com

myorigin = magedu.com

mydomain = magedu.com

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

mynetworks = 192.168.1.0/24, 127.0.0.0/8

3、為postfix提供sysv服務指令碼/etc/init.d/postfix

#!/bin/bash

## postfix postfix mail transfer agent

## chkconfig: 2345 80 30

# description: postfix is a mail transport agent, which is the program \

# that moves mail from one machine to another.

# processname: master

# pidfile: /var/spool/postfix/pid/master.pid

# config: /etc/postfix/main.cf

# config: /etc/postfix/master.cf

# source function library.

. /etc/rc.d/init.d/functions

# source networking configuration.

. /etc/sysconfig/network

# check that networking is up.

[ $networking = "no" ] && exit 3

[ -x /usr/sbin/postfix ] || exit 4

[ -d /etc/postfix ] || exit 5

[ -d /var/spool/postfix ] || exit 6

retval=0

prog="postfix"

start()

stop()

reload()

abort()

flush()

check()

restart()

# see how we were called.

case "$1" in

start)

start

;;stop)

stop

;;restart)

stop

start

;;reload)

reload

;;abort)

abort

;;flush)

flush

;;check)

check

;;status)

status master

;;condrestart)

[ -f /var/lock/subsys/postfix ] && restart || :

;;*)

echo $"usage: $0 "

exit 1

esac

exit $?

# end

4、為此指令碼賦予執行許可權

chmod +x /etc/init.d/postfix

5、將postfix服務新增至服務列表

chkconfig --add postfix

6、設定其開機自動啟動

chkconfig postfix on

7、重新啟動服務

service postfix restart

8、為postfix服務開啟使用者別名支援

啟用alias_maps = hash:/etc/aliases

在/etc/aliases檔案中定義新的別名項

redhat: magedu

[email protected]: [email protected]

將/etc/aliases轉換為hash格式

讓postfix重新載入配置檔案

/usr/sbin/postfix reload

9、實現postfix基於客戶端的訪問控制

例如:禁止172.16.100.66這台主機通過工作在172.16.100.1上的postfix服務傳送郵件。訪問表使用hash的格式。

定義:172.16.100.66 reject

2、將此檔案轉換為hash格式

postmap /etc/postfix/access

3、配置postfix使用此檔案對客戶端進行檢查

smtpd_client_restrictions = check_client_access hash:/etc/postfix/access

4、讓postfix重新載入配置檔案即可進行發信控制的效果測試了。

/usr/sbin/postfix reload

郵件傳輸協議

定義了郵件客戶端與smtp伺服器之間,以及兩台smtp伺服器之間的通訊規則。smtp協議的通訊雙方採用一問一答的命令 響應形式進行對話,smtp協議定義了對話的規則和所有命令 響應的語法格式。smtp協議分為標準smtp協議和擴充套件smtp協議 esmtp,extension mail trans...

郵件傳輸協議

使用者連線上郵件伺服器之後,要想給它傳送一封電子郵件,需要遵循一定的通訊規則,smtp 協議就是用來定義這種通訊規則的。因此,我們通常也把處理使用者 smtp請求 郵件傳送請求 的伺服器稱之為 smtp 伺服器 郵件傳送伺服器 通俗來說 smtp 協議是用來傳送郵件的 pop3 3封郵件並移動到其他...

郵件傳輸協議簡介

pop3協議 主要用於支援使用客戶端遠端管理訪問位於伺服器上的電子郵件。通常和埠110繫結。一般我們可以在本地通過telnet連線郵件伺服器,然後執行pop3命令管理位於郵件伺服器的電子郵件 比如在控制台輸入命令 telnet 郵件伺服器的ip位址 pop3埠號,這樣就會開啟乙個到郵件伺服器的pop...