Configure your First e-mail server (top)

Source: Internet
Author: User
Tags exit mail modify domain domain name nslookup

With the development of Internet, e-mail has grown rapidly into a major network information transfer tool. Faced with the demand for fast, inexpensive, and highly reliable e-mail, many companies and individuals use the services provided by Linux as a solution to meet these needs.

SendMail was originally written by Ericallman in 1979. It runs on the BSD4.0 platform at first. But the program is not flexible enough to be reconfigured every time you compile it. With the TCP protocol and other developments, its own inflexibility has clearly failed to meet the growing demand. Ericallman decided to rewrite the SendMail, which gave birth to the current MTA standard. This is a brief introduction to SendMail. Our article is mainly to demonstrate how to use the configuration SendMail8.11.2 service on a newly installed redhat7.1, frame your e-mail server.

The SendMail8.11 service has been installed redhat7.1 the default installation time. Because the Redhat installation is very easy to use, we ignore the installation process here, Please refer to the documentation in REDHATCD. To make your new e-mail server work correctly, you must first troubleshoot DNS issues. Add the hostname and IP address of your e-mail server to DNS and use Nslookup to confirm:
  

The following are the referenced contents:
[Root@testmail/root] #nslookup-siltestmail.blank.com
server:192.168.100.1
address:192.168.100.1#53
Name:testmail.blank.com
address:192.168.100.134

  
Also you have to try reverse domain name resolution, which is important to prevent mail latency. Now most of the mail servers are the reverse domain name resolution as a part of the authentication of mail delivery. So use your IP address to try the reverse Domain name resolution is correct.
  
The following are the referenced contents:
[Root@testmail/root] #nslookup-sil192.168.100.134
server:192.168.100.1
address:192.168.100.1#53
  
134.100.168.192.in-addr.arpaname=testmail.blank.com.

  
As you can see, the DNS service is working properly, so let's go ahead and configure the SendMail service. redhat7.1 The default installation already enables the SMTP service to run on the local computer.

You use NETSTAT-NL to see all the daemons listening to the port, note this line: 127.0.0.1:25, this means that the SendMail service is already listening on the local (SMTP) port:
  

The following are the referenced contents:
[Root@testmail/root] #netstat-NL
Activeinternetconnections (Onlyservers)
Protorecv-qsend-qlocaladdressforeignaddressstate
Tcp000.0.0.0:327680.0.0.0:*listen
Tcp000.0.0.0:1110.0.0.0:*listen
Tcp000.0.0.0:220.0.0.0:*listen
Tcp00127.0.0.1:250.0.0.0:*listen
udp000.0.0.0:327680.0.0.0:*
udp000.0.0.0:6670.0.0.0:*
udp000.0.0.0:1110.0.0.0:*
Activeunixdomainsockets (Onlyservers)
Protorefcntflagstypestatei-nodepath
Unix2[acc]streamlistening1119/dev/gpmctl
Unix2[acc]streamlistening1172/tmp/.font-unix/fs7100[page]


  
But this only means that the e-mail server only receives mail from your computer. To solve this problem, you must modify the configuration and tell SendMail to monitor your external network card address. Suppose you have only one network card installed on your server (eth0), and configure your IP address with ifconfig, this address can be different from DNS resolution, but you want to ensure that DNS can correctly resolve mail server address. The address we use here is the same (recommended):
  

The following are the referenced contents:
[Root@testmail/root] #ifconfig
eth0linkencap:ethernethwaddr00:60:97:de:e9:99
inetaddr:192.168.100.134bcast:192.168.100.255mask:255.255.255.0
Upbroadcastrunningmulticastmtu:1500metric:1
rxpackets:12421errors:0dropped:0overruns:0frame:0
txpackets:5errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:100
interrupt:10baseaddress:0xe000
  
  
Lolinkencap:localloopback
inetaddr:127.0.0.1mask:255.0.0.0
Uploopbackrunningmtu:16436metric:1
rxpackets:6errors:0dropped:0overruns:0frame:0
txpackets:6errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:0


  
You can see that the eth0 IP address of this host is 192.168.100.134. Now modify the/ETC/SENDMAIL.CF file to configure the SendMail listening port:
  

The following are the referenced contents:
#SMTPdaemonoptions
Odaemonportoptions=port=smtp,addr=127.0.0.1,name=mta
  
Change to
  
Odaemonportoptions=port=smtp,addr=192.168.100.134,name=mta
 

Save the exit after the change, and restart the SendMail service:
  

The following are the referenced contents:
[Root@testmail/root]#/etc/init.d/sendmailrestart
Shuttingdownsendmail:[ok]
Startingsendmail:[ok]
[root@testmail/root]#

  
Now you can use NETSTAT-NL to see if it has changed. As you see, SendMail's listening port is now Eth0 's IP address: 192.168.100.134.

The following are the referenced contents:
[Root@testmail/root] #netstat-NL
Activeinternetconnections (Onlyservers)
Protorecv-qsend-qlocaladdressforeignaddressstate
Tcp000.0.0.0:327680.0.0.0:*listen
Tcp000.0.0.0:1110.0.0.0:*listen
Tcp000.0.0.0:220.0.0.0:*listen
Tcp00192.168.100.134:250.0.0.0:*listen
udp000.0.0.0:327680.0.0.0:*
udp000.0.0.0:6670.0.0.0:*
udp000.0.0.0:1110.0.0.0:*
Activeunixdomainsockets (Onlyservers)
Protorefcntflagstypestatei-nodepath
Unix2[acc]streamlistening1119/dev/gpmctl
unix2[acc]streamlistening1172/tmp/.font-unix/fs7100
[root@testmail/root]#
  
///////////////////////////////////////////////////////////////

  
Now SendMail can already receive connections from the outside. We also need to set the domain name that SendMail allows to receive. This can be set in the/etc/mail/local-host-names file. You can enter the domain name:
  
The following are the referenced contents:
#local-host-names-includeallaliasesforyourmachinehere.
Blank.com

  
Restart the SendMail service after the save exit:/etc/init.d/sendmailrestart. So sendmail can receive letters from multiple domains.

If you need to add a new domain, you can only modify this file.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.