sendmail

nslookup
set q=mx
example
to ensure the mail server is ready


add MX to example.com.zone and 192.168.1.zone
rndc reload

ensure port25 is open (smtp) in both send and reciepient.
nmap localhost to check

install postfix and sendmail to ensure the port25 is open
yum install system-switch-mail

sendmail.mc must be dnl 127.0.0.1
un dnl to enable ipv4 and ipv6 to sendmail

m4 sendmail.mc > sendmail.cf

vi /etc/mail/local-host-name
server.example.com

vi /etc/mail/access
192.168.1. relay

vi /etc/aliases
newaliase

make -C /etc/mail

send to mail server will work while send to account on other machine on the lan is not working
such as  mail xing@server.example.com   ok
        mail xing@client.example.com  no mail will be received
#block mails from example.com ,relay mails from 192.168.0.0/24
vi /etc/mail/access
192.168.0  relay
@example.com   reject
 
#mails going from LAN masquerate as example.com
vi /etc/mail/sendmail.mc
MASQUERADE_AS('example.com')dnl
 
#any incoming mail for [email protected] vitual address should be map to [email protected]
vi /etc/mail/virtusertable
 
#All outgoing mail should be sent via smpt.abc.com mail server
vi /etc/mail/sendmail.mc
define('SMART_HOST','smtp.abc.com')
 
#All mails to example.com should get by xing user
vi /etc/mail/virtusertable
@example.com  xing
service sendmail restart
chkconfig sendmail on
 
#All mails coming for accountmanager should get by xing
vi /etc/mail/virtusertable
accountmanager@  xing

------------------
test email
[root@station15 mail]# telnet 192.168.0.6 25
Trying 192.168.0.6...
Connected to station6.example.com (192.168.0.6).
Escape character is '^]'.
220 station6.example.com ESMTP Sendmail 8.13.8/8.13.8; Sun, 31 Oct 2010 16:41:38 +0800
helo station6
250 station6.example.com Hello station15.example.com [192.168.0.15], pleased to meet you
mail from:[email protected]
250 2.1.0 [email protected]... Sender ok
rcpt to:[email protected]
250 2.1.5 [email protected]... Recipient ok
data
354 Enter mail, end with "." on a line by itself
this is test.
.
250 2.0.0 o9V8fcLC006097 Message accepted for delivery
quit
221 2.0.0 station6.example.com closing connection
Connection closed by foreign host.

------
check if the email received.
/var/spool/mail/root
-------







 
 
 
 
 
 




















 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章