16. Simple Self-made email server and 16 self-made email server

Source: Internet
Author: User
Tags domain name server

16. Simple Self-made email server and 16 self-made email server

1. Protocol Service:

SMTP tcp 25 port mail storage and delivery
POP3 tcp 110 port users read and write emails

 


 

2. SERVER: (SMTP port 25)
Sendmail is mature and easy to configure
Postfix AIX system development (IBM) is not easy to configure in Linux
Gmail is known to be fast and competent

 

3. Client: (POP3 port 110)
Text: mutt
Image: foxmail evolution

 

1. Configure the mail Domain Name Server

[Root @ localhost root] # vi/var/named/gr.org. db

$TTL 86400@  IN  SOA  ns.gr.org.    root.gr.org.(            20140308 ;serial            8H       ;refresh            4M       ;retry            1W       ;expiry            1D  )    ;minimum@      IN   NS      ns.gr.org.ns     IN   A       192.168.170.1host1  IN   A       192.168.170.1host2  IN   A       192.168.170.2host3  IN   A       192.168.170.3@      IN   MX  10  mail.gr.org.mail   IN   A       192.168.170.1

Restart service

[Root @ localhost root] # rndc reload

Test

[Root @ localhost root] # nslookup-sil mail.gr.org
Server: 192.168.170.3
Address: 192.168.170.3 #53

Name: mail.gr.org
Address: 192.168.170.1

 

Ii. sendmail configuration

1. Check if sendmail is installed.

[Root @ localhost root] # cd/etc/mail
[Root @ localhost mail] # rpm-q sendmail
Sendmail-8.12.8-4

(Sendmail configuration experiment key steps:
Modify sendmail. mc and then use m4 to generate sendmail. cf
Modify local-host-name to set the email receiving domain
Access (access Control) generates access. db through makemap
Aliases group generation aliases. db through newaliases
Service sendmail restart (restart the service)
)

 

2. Configure the core file:

[Root @ localhost mail] # vi/etc/mail/sendmail. mc

The changes are as follows:

1) Listening network segment
DAEMON_OPTIONS ('port = smtp, Addr = 127.0.0.1, Name = MTA ') dnl
Change
DAEMON_OPTIONS ('port = smtp, Addr = 0.0.0.0, Name = MTA ') dnl

M4/etc/mail/sendmail. mc>/etc/mail/sendmail. cf

 

4. Set the recipient's domain
[Root @ localhost mail] # vi/etc/mail/local-host-names

Gr.org
Mail.gr.org

 

5. Create a group and a user

[Root @ localhost mail] # groupadd stu
[Root @ localhost mail] # useradd huji-g stu-s/sbin/nologin
[Root @ localhost mail] # passwd huji
Changing password for user huji.
New password:
Bad password: it is based on a dictionary word
Retype new password:
Passwd: all authentication tokens updated successfully.
[Root @ localhost mail] # useradd stu-g stu-s/sbin/nologin
[Root @ localhost mail] # passwd stu
Changing password for user stu.
New password:
Bad password: it is based on a dictionary word
Retype new password:
Passwd: all authentication tokens updated successfully.

[Root @ localhost root] # useradd wuji-g stu-s/sbin/nologin
[Root @ localhost root] # passwd wuji
Changing password for user wuji.
New password:
Retype new password:
Passwd: all authentication tokens updated successfully.


 

6. Set the group alias:
[Root @ localhost mail] # vi/etc/aliases
Add two rows:
Root: root, yanji
Stu: yanji, wuji, huji

 

7. Generate the aliases. db database:

[Root @ localhost mail] # newaliases/etc/aliases: 64 aliases
/Etc/aliases: 65 aliases, longest 15 bytes, 657 bytes total

 

8. Set access control:
[Root @ localhost mail] # vi/etc/mail/access
192.168.170.0/24 RELAY
Gr.org RELAY
Mail.gr.org RELAY

 

9. Update the aliases. db database
[Root @ localhost mail] # makemap-r hash/etc/mail/access. db </etc/mail/access

 

10. Restart the service
[Root @ localhost mail] # service sendmail restart
Disable sendmail: [OK]
Close sm-client: [OK]
Start sendmail: [OK]
Start sm-client: [OK]

 

Test now

Method 1,

Email: (Subject: Greet: Hello, yanji .)
[Root @ localhost mail] # echo "Hello, yanji." | mutt-s "Greet" yanji@gr.org

View emails
[Root @ localhost mail] # su-yanji
[Yanji @ localhost yanji] $ zh
[Yanji @ localhost yanji] $ mutt

Chkconfig ipop3 on
[Root @ localhost root] # service xinetd restart
Stop xinetd: [OK]
Start xinetd: [OK]

 

Disable local connections to prevent Internet access. Specify the VMware8 DNS server as 192.168.170.3.

Create accounts for huji and wuji

Send an email to stu and all the Members in the stu group will receive an email.

[Root @ localhost root] # echo "Hello, student." | mutt-s "Greet" stu@gr.org

The verification is as follows:

 

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.