#yum install postfix

#vim /etc/postfix/main.cf
myhostname = postfix.contoso.msft
mydomain = contoso.msft
myorigin = #myhostname
mydestination = $mydomain
inet_interfaces = all
mynetworks_style = class
mynetworks = 10.1.1.0/24
relay_domain = $mydomain

#telnet 127.0.0.1 25
mail from:zhang3@contoso.msft
rcpt to:li4@contoso.msft
data
subject:just for test
Mail's body,sth here!
.
quit

#yum install cyrus-sasl-devel*

#vim /etc/postfix/main.cf
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_recipient_restrictions = permit_sasl_authenticated,reject_unauth_destination,permit_mynetworks,reject_non_fqdn_recipient,reject_unknown_recipient_domain
smtpd_sasl_authenticated_header = yes
broken_sasl_auth_clients = yes
smtpd_sasl_path = smtpd
smtpd_helo_required = yes
smtpd_client_restrictions = check_client_access,hash:/etc/postfix/ClientAccess
smtpd_helo_restrictions = reject_invalid_hostname,check_helo_access,hash:/etc/postfix/HeloAccess
smtpd_sender_restrictions = reject_non_fqdn_sender,reject_unknown_sender_domain,check_sender_access,hash:/etc/postfix/SenderAccess

#yum install spamassassin

#vim /etc/postfix/master.cf
smtp      inet  n       -       n       -       -       smtpd -v -o content_filt
er=spamassassin
spamassassin unix - n n - - pipe flags = Rq user = spuser argv=/usr/bin/spamc -d 127.0.0.1 -f -p 783 -t 30 -e /usr/sbin/sendmail -oi -f $(sender) --$(recipient)