一.郵件伺服器基本概念:
1.郵件傳輸協定
SMTP:Simple Mail Transfer Protocol
POP3:Post Office Protocol
IMAP4:Internet Mail Access Protocol
2.smtpd監聽(25/tcp)
3.SASL:Simple Authentication Secure Layer
cyrus-sasl
courier-authlib
4.MDA:郵件投遞代理,MDA是挂在MUA下的一個小功能,它的主要功能是分析郵件的表頭,決定郵件去向
procmail,maildrop
5.MUA:郵件使用者代理,即郵件用戶端軟體,如Windows的Outlook,客戶通過它來浏覽、寫和收郵件
mutt(文本界面),mail,thunderbird,evolution
6.MTA:郵件傳輸代理,當你在MUA(如outlook)上點發郵件時,其實它是把郵件發到MTA(如SendMail, Postfix),通過MTA實作發郵件的功能
sendmail,qmai,postfix,exim
7.MRA:郵件檢索代理(pop3,imap4),MUA向MRA發送請求接收郵件
cyrus-imap
dovecot
二.簡單郵件發送過程
1.用戶端向服務端發送hello資訊來建立連接配接
helo(smtp協定)
ehlo(esmtp協定)
2.用戶端向伺服器發送發件人資訊
mail from
3.用戶端向伺服器端發送收件人資訊
rcpt to
4.用戶端向伺服器端發送郵件主體
[root@localhost ~]# telnet localhost 25
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 localhost.localdomain ESMTP Postfix
helo localhost
250 localhost.localdomain
mail from:root
250 2.1.0 Ok
rcpt to:apache
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
hello
.
250 2.0.0 Ok: queued as 75749279
quit
221 2.0.0 Bye
Connection closed by foreign host.
You have mail in /var/spool/mail/root
[root@localhost ~]#