sendmail配置
一,安裝:
[root@station10 ~]# yum install -y sendmail*
[root@station10 ~]# rpm -aq | grep sendmail
sendmail-doc-8.13.8-2.el5
sendmail-cf-8.13.8-2.el5
sendmail-devel-8.13.8-2.el5
sendmail-8.13.8-2.el5
[root@station10 ~]#
二,sendmail進入的配置
1,修改 /etc/mail/sendmail.mc 檔案,讓監聽所有網路卡地址,在前面加上dnl # 即可:
[root@station10 mail]# vi sendmail.mc
dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
2,修改 /etc/mail/local-host-names 檔案。
[root@station10 mail]# cat local-host-names
# local-host-names - include all aliases for your machine here.
station10.example.com
[root@station10 mail]#
3,重啟 sendmail
[root@station10 mail]# service sendmail restart
Shutting down sendmail: [FAILED]
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
[root@station10 mail]#
4,檢視監聽的埠:
[root@station10 ~]# netstat -tulpn | grep sendmail
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 1094/sendmail: acce
[root@station10 ~]#
5,測試
[root@station10 ~]# mail -v root
Subject: test mail
test.
.
Cc:
root... Connecting to [127.0.0.1] via relay...
220 station10.example.com ESMTP Sendmail 8.13.8/8.13.8; Tue, 21 Oct 2008 00:13:23 +0800
>>> EHLO station10.example.com
250-station10.example.com Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> MAIL From:<> SIZE=35
250 2.1.0 <>... Sender ok
>>> RCPT To:<>
>>> DATA
250 2.1.5 <>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 m9KGDNiO001110 Message accepted for delivery
root... Sent (m9KGDNiO001110 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 station10.example.com closing connection
[root@station10 ~]#
三,sendmail 出去的配置
1,umcomment the following linex in /etc/mail/sendmail.mc
EXPOSED_USER(`root')dnl
FEATURE(masquerade_envelope)dnl
MASQUERADE_AS('station10.example.com')dnl
FEATURE(masquerade_entire_domain)dnl
2,測試
[root@station10 ~]# mail -v
Subject: test
from station10.example.com
.
Cc:
... Connecting to [127.0.0.1] via relay...
220 station10.example.com ESMTP Sendmail 8.13.8/8.13.8; Tue, 21 Oct 2008 00:43:26 +0800
>>> EHLO station10.example.com
250-station10.example.com Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> MAIL From:<> SIZE=73
250 2.1.0 <>... Sender ok
>>> RCPT To:<>
>>> DATA
250 2.1.5 <>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 m9KGhQAN001280 Message accepted for delivery
... Sent (m9KGhQAN001280 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 station10.example.com closing connection
[root@station10 ~]#
3,在其他機器上接收郵件
[root@station12 ~]# mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/root": 1 message 1 new
>N 1 Tue Oct 21 07:56 19/905 "test"
& 1
Message 1:
From Tue Oct 21 07:56:06 2008
Date: Tue, 21 Oct 2008 00:43:26 +0800
From: root <>
To:
Subject: test
from station10.example.com
& q
Saved 1 message in mbox
[root@station12 ~]#
四,進入的郵箱別名
1,本地別名配置:/etc/aliases
[root@station10 mail]# vi /etc/aliases
新增:
xxx: root
xxx這個名字可以是不存在的使用者,使用者名稱後面記得加:
2,執行newaliases讓配置生效。
[root@station10 ~]# newaliases
/etc/aliases: 77 aliases, longest 10 bytes, 772 bytes total
[root@station10 ~]#
3,測試
[root@station10 ~]# mail xxx
Subject: test inbound
send to xxx
.
Cc:
[root@station10 ~]# mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/root": 1 message 1 new
>N 1 Tue Oct 21 00:51 16/659 "test inbound"
& 1
Message 1:
From Tue Oct 21 00:51:43 2008
Date: Tue, 21 Oct 2008 00:51:43 +0800
From: root <>
To:
Subject: test inbound
send to xxx
& q
Saved 1 message in mbox
[root@station10 ~]#
4,虛擬別名配置:
修改/etc/mail/virtusertable檔案,增加下面一行:
[root@station10 mail]# cat virtusertable
[root@station10 mail]#
5,重啟服務
[root@station10 mail]# service sendmail restart
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
[root@station10 mail]#
6,測試:
傳送到station10伺服器中:
[root@station10 mail]# mail
Subject: test inbound sendmail Aliases
send to station10
.
Cc:
[root@station10 mail]#
在station12伺服器中接收到資料:
Saved 1 message in mbox
[root@station12 ~]# mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/root": 1 message 1 new
>N 1 Tue Oct 21 08:13 19/921 "test inbound sendmail"
& 1
Message 1:
From Tue Oct 21 08:13:36 2008
Date: Tue, 21 Oct 2008 01:00:56 +0800
From: root <>
To:
Subject: test inbound sendmail Aliases
send to station10
& q
Saved 1 message in mbox
[root@station12 ~]#
五,出去的地址重寫
1,在/etc/mail/sendmail.mc中增加如下內容:
FEATURE(genericstable)dnl
FEATURE(`always_add_domain')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/local-host-names')dnl
例子,檔案最後幾行:
dnl MASQUERADE_DOMAIN(mydomain.lan)dnl
FEATURE(genericstable)dnl
FEATURE(`always_add_domain')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/local-host-names')dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
dnl MAILER(cyrusv2)dnl
2,新增檔案 /etc/mail/genericstable,並新增如下內容:
[root@station10 mail]# cat /etc/mail/genericstable
[root@station10 mail]#
3,重啟服務
[root@station10 mail]# /etc/init.d/sendmail restart
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
[root@station10 mail]#
4,測試:
傳送郵件給station12.example.com
[root@station10 ~]# mail
Subject: station10.example.com
test
.
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 Tue Oct 21 11:14 69/2334 "Logwatch for station1"
N 2 Wed Oct 22 02:39 19/867 "station10.example.com"
& 2
Message 2:
From Wed Oct 22 02:39:53 2008
Date: Tue, 21 Oct 2008 19:26:56 +0800
From: root <>
To:
Subject: station10.example.com
test
& q
Saved 1 message in mbox
Held 1 message in /var/spool/mail/root
[root@station12 ~]#
六,垃圾郵件限制:
1,enable in /etc/mail/sendmail.mc using
FEATURE('blacklist_recipients')dnl
2, add restrictions in /etc/mail/access
From:90trialspammer@aol.com REJECT
Connect:spamRus.net REJECT
Connect:204.168.23 REJECT
Connect:10.3 OK
From:virtualdomain1.com RELAY
to:user@dom9.com ERROR:550 mail discarded
to:nobody@ ERROR:550 bad name
七,Sendmail Operation
mail -v user
view SMTP exchange with local relay
mailq and mailq -Ac
view messages queued for future delivery
sendmail -q
reprocess the email queue
tail -f /var/log/maillog
view log in real-time
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/312079/viewspace-1012207/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Sendmail relay規則及配置檔案用法彙總 sendmail配置 (轉)AI
- 安裝和配置sendmailAI
- ebs12 sendmail配置AI
- REDHAT 7.1 sendmail配置FAQ (轉)RedhatAI
- HP-UX啟動停止配置sendmail服務方法UXAI
- sendmail settingAI
- 在紅旗Linux Server4.1中配置sendmail(轉)LinuxServerAI
- linux下關閉sendmailLinuxAI
- [Linux] mutt+msmtp sendmailLinuxAI
- [Developer] Oracle sendmail procedure(1)(轉載)DeveloperOracleAI
- sendmail出現"MXlistforhostnamepointsbacktohostname"問(轉)AI
- [Shell] monitor oracle alert.log file and sendmailOracleAI
- Linux下的sendmail簡介(轉)LinuxAI
- 8.Monitor oracle alert.log file and sendmailOracleAI
- Linux基礎命令---sendmail傳送郵件LinuxAI
- php不能呼叫sendmail發信的解決方法PHPAI
- Linux下停止SendMail程式[Linux基礎]LinuxAI
- CentOS下使用MSMTP代替Sendmail傳送郵件CentOSAI
- 用sendmail傳送HTML格式的郵件(轉)AIHTML
- 把JavaMail包裝成簡單的Sendmail (轉)JavaAI
- 在Perl中使用sendmail傳送MIME郵件 (轉)AI
- 選擇代替Sendmail的郵件伺服器軟體AI伺服器
- sendmail的log裡面maybeforged是什麼意思?(轉)AI
- Redhat中sendmail只監聽127.0.0.1怎麼辦(轉)RedhatAI127.0.0.1
- linux下sendmail郵件系統安裝操作記錄LinuxAI
- 在 CentOS 7 中使用 Sendmail 通過 PHP 傳送郵件CentOSAIPHP
- crond不斷喚起sendmail導致資源耗盡的排查AI
- [20160828]Linux SendMail服務啟動慢解決LinuxAI
- 在CentOS7中使用Sendmail通過PHP傳送郵件CentOSAIPHP
- linux 啟動 sendmail 和 sm-client 慢的解決辦法LinuxAIclient
- 為什麼當系統啟動到Sendmail時會暫停(轉)AI
- ipf導致sendmail不能正確轉發郵件的問題解決AI
- [轉]Linux開機時停在 Starting sendmail 不動了的解決方案LinuxAI
- linux安全設定(升級SSH,關閉telnet,停止FTP,停止sendmail等)LinuxFTPAI
- sendmail中一種限定使用者郵箱大小的實用方法(轉)AI
- linux 啟動 sendmail 和 sm-client 慢的解決辦法之補充LinuxAIclient
- linux 啟動sendmail和sm-client慢的解決辦法 及報錯LinuxAIclient
- Linux啟動時在sendmail出現make: warning: Clock skew detected.的解決辦法LinuxAI