16, simple home-made mail server

Source: Internet
Author: User
Tags domain name server

1. Protocol Services:

SMTP TCP 25 port mail storage and delivery
POP3 TCP 110 Port user read, write mail


2. Server: (SMTP 25 port)
SendMail mature, easy to configure
Postfix AIX System Development (IBM) so Linux is not easy to configure
Gmail claims to be fast and capable of processing

3, Client: (POP3 110 port)
Text: Mutt
Graphics: Foxmail Evolution

First, configure the mail domain name server

[Email protected] 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  ten  mail.gr.org.mail   in   A        192.168.170.1

Restart Service

[email protected] root]# RNDC Reload

Test

[Email protected] 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

Second, sendmail configuration

1. See if SendMail is installed.

[Email protected] root]# Cd/etc/mail
[Email protected] mail]# rpm-q sendmail
Sendmail-8.12.8-4

(SendMail Configuration Experiment key steps:
Modify SENDMAIL.MC, and then generate SENDMAIL.CF by M4
Modify Local-host-name to set up a domain for a received message
Access control generates ACCESS.DB through Makemap
Aliases set up mass through newaliases generation aliases.db
Service SendMail Restart (restart services)

2. Configure the core file:

[Email protected] mail]# VI/ETC/MAIL/SENDMAIL.MC

Change the place as below 3

1) Listening Network segment
Daemon_options (' port=smtp,addr=127.0.0.1, Name=mta ') dnl
Switch
Daemon_options (' port=smtp,addr=0.0.0.0, Name=mta ') dnl

2) Local domain name
Local_domain (' Localhost.localdomain ') dnl
Switch
Local_domain (' gr.org ') dnl

3) Turn on the authentication function:
Remove the DNL from the beginning of the following three lines:

DNL daemon_options (' Port=submission, Name=msa, M=ea ')


DNL Trust_auth_mech (' EXTERNAL digest-md5 cram-md5 LOGIN PLAIN ') dnl
DNL define (' confauth_mechanisms ', ' EXTERNAL GSSAPI digest-md5 cram-md5 LOGIN PLAIN ') dnl

3, establish/ETC/MAIL/SENDMAIL.CF
[Email protected] mail]# M4/ETC/MAIL/SENDMAIL.MC >/ETC/MAIL/SENDMAIL.CF

4. Set the domain of the pickup
[Email protected] mail]# vi/etc/mail/local-host-names

gr.org
mail.gr.org

5. Set up groups and users

[Email protected] mail]#Groupadd Stu
[Email protected] mail]#useradd huji-g stu-s/sbin/nologin
[Email protected] mail]#passwd Huji
Changing password for user Huji.
New Password:
Bad Password:it are based on a dictionary word
Retype new Password:
Passwd:all authentication tokens updated successfully.
[Email protected] mail]#useradd stu-g stu-s/sbin/nologin
[Email protected] mail]#passwd Stu
Changing password for user Stu.
New Password:
Bad Password:it are based on a dictionary word
Retype new Password:
Passwd:all authentication tokens updated successfully.

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


6, set the mass alias:
[Email protected] mail]# vi/etc/aliases
Add two lines:
Root:root,yanji
Stu:yanji,wuji,huji

7. Generate ALIASES.DB Database:

[Email protected] mail]# newaliases/etc/aliases:64 aliases
/etc/aliases:65 aliases, longest bytes, 657 bytes Total

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

9. Update Aliases.db Database
[Email protected] mail]# makemap-r hash/etc/mail/access.db </etc/mail/access

10. Restart Service
[Email protected] mail]#Service SendMail Restart
Close sendmail: [OK]
Close sm-client: [OK]
Start sendmail: [OK]
Start sm-client: [OK]

Now, test it.

Method One,

E-Mail: (Write to Yanji topic: Greet content: Hello, Yanji.)
[Email protected] mail]# echo "Hello, Yanji." | mutt-s "Greet" [email protected]

View Mail
[Email protected] mail]# Su-yanji
[Email protected] yanji]$ en
[Email protected] yanji]$ Mutt

Yes, enter


Method Two,

Verifying with Foxmail in Windows

[[email protected] root]# chkconfig  ipop3  on
[[email protected] root]# service   xinetd  restart
Stop xinetd:                                                [  OK  ]
start xinetd:                                                 [  OK  ]

Disable local connections and do not allow Internet access. Designate the VMware8 DNS server as 192.168.170.3.

Foxmail Add Yanji Account

Mass

Create accounts for Huji and Wuji first

Send an e-mail to Stu and send an email to all members of this Stu group

[Email protected] root]# echo "Hello, student." | Mutt-s "Greet" [email protected]

Verify the following

16, simple home-made mail server

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.