Set up Sendmail email server for Fedora6

Source: Internet
Author: User
Fedora6 sets up the Sendmail mail server-Linux Enterprise Application-Linux server application information. The following is a detailed description. (Solve the problem that the NObody and domain name of php mail are localhost. domain)
After nearly a week, I have basically understood the basic things. During the setup process, I have referenced countless articles on the Internet. Now I have made a comprehensive introduction and provided a reminder in important places.
1. install necessary software
(1) query rpm-qa sendmail m4
The results show that necessary software has been installed. If not, use the yum install sendmail command to install the software (if you can access the Internet) or use the System Disk for installation (if you have a CD, iso files can also be used)
(2) install the associated suite
Sendmail-dev, sendmai-doc sendmail-cf
We recommend that you use yum installation (yum install sendmai * or mount the disc to install rpm-ivh sendmail-*) for the use of yum, please refer to the I reproduced yum basic use: http://zm177cm.blog.163.com/blog/static/114612382007102045940710
(3) After successful installation
Vi/etc/mail/local-host-names open this file and add the domain name you want to use when sending emails to it (it can be virtual, but it is not recommended to use existing domain names, suspected of infringement ~ Is also prone to errors)

[Root @ localhost named] # cat/etc/mail/local-host-names

# Local-host-names-include all aliases for your machine here.

Ltest.com


Test.com is what you want to fill in ~~~
(4) Rebuilding sendmail. cf

Sendmail. cf is the configuration file of sendmail. Modify it by modifying the sendmail. mc file,


DaemonPortsOptions = Port = smtp, Addr = 127.0.0.1, Name = MTA changed:

DaemonPortsOptions = Port = smtp, Addr = yourip or 0.0.0.0, Name = MTA

Or comment out this line with dnl (that is, add dnl before this line and then add a space to dnl, according to the linux System Management Manual, delete to next lin means that some of my friends explained that do not load seems correct, but that means I don't care about it. I just want to understand it)


Then m4/etc/mail/sendmail. mc>/etc/mail/sendmail. cf (re-create sendmail. cf or you can back up the file first. Everyone prefers it ~~)

(5) modify user authentication

Or the above file vi/etc/mail/sendmail. mc is entered and found
48 lines dnl TRUST_AUTH_MECH ('external DIGEST-MD5 login plain ') dnl
49 rows dnl define ('confauth _ MECHANISMS ', 'external GSSAPI DIGEST-MD5 CRAM-MD5 login plain') dnl
#? H drop above? Shang Xing yaodnl
# Note: Do not leave spaces before TRUST_AUTH_METH and define

Line 2 dnl DAEMON_OPTIONS ('port = smtp, Addr = 127.0.0.1, Name = MTA ') dnl

# Add dnl to the front and set? OK? Start? Why? Nl = do not load)

# Or change it to the following ?? Right tip? Br/>
DAEMON_OPTIONS ('port = smtp, Addr = 0.0.0.0, Name = MTA ') dnl

Note: The above modified User Authentication section references an article I have reproduced:

(6) modify the port

Dnl DAEMON_OPTIONS ('port = submission, Name = MSA, M = Ea ') dnl

Remove the annotator at the beginning of the line and change the content to Port = 25:

DAEMON_OPTIONS ('port = 25, Name = Ms') dnl

Authenticate the default smtp port (25), instead of the port 587. In this way, all users who use this email server (that is, the server we set up now) for Email Forwarding can only send emails after authentication.


Run the m4 program again

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

Use m4 to regenerate the sendmail. cf file

(7) Add email users

Create a user account

[Root @ localhost named] # groupadd mailuser

[Root @ localhost named] # adduser-g mailuser-s/sbin/nologin mike

[Root @ localhost named] # adduser-g mailuser-s/sbin/nologin john

[Root @ localhost named] # passwd mike

[Root @ localhost named] # Add a few passwd john passwords as you like (this section references another reprinted article)

(8) Access Control

5. Access control settings

Change the/etc/mail/accesss file and add:

[Root @ localhost named] # cat/etc/mail/access

# Check the/usr/share/doc/sendmail/README. cf file for a description

# Of the format of this file. (search for access_db in that file)

# The/usr/share/doc/sendmail/README. cf is part of the sendmail-doc

# Package.

#

# By default we allow relaying from localhost...

Localhost. localdomain RELAY

Localhost RELAY

127.0.0.1 RELAY

Ltest.com RELAY, no verification is performed. I hope my friend can help me verify it.])

Then, makemap hash/etc/mail/access. db </etc/mail/access updates the database.

(9) restart the service
[Root @ localhost named] # service sendmail restart
See
Close sm-client: [OK]
Disable sendmail: [OK]
Start sendmail: [OK]
Start sm-client: [OK]
It is correct (the other two are OK, because it will fail if the service is not started)
(10) test Server

[Root @ localhost named] # telnet localhost 25

Trying 127.0.0.1...

Connected to localhost. localdomain (127.0.0.1 ).

Escape character is '^]'.

220 localhost. localdomain ESMTP Sendmail 8.13.1/8.13.1; Sat, 17 Mar 2007 12:54:47 + 0800

Ehlo localhost (user input)

250-localhost.localdomain Hello localhost. localdomain [127.0.0.1], pleased to meet you

250-ENHANCEDSTATUSCODES

250-PIPELINING

250-8BITMIME

December 250-SIZE

250-DSN

250-ETRN

250-AUTH DIGEST-MD5 CRAM-MD5 login plain --- authentication should take effect

250-DELIVERBY

250 HELP

Quit (user input to exit telnet)

221 2.0.0 localhost. localdomain closing connection

Connection closed by foreign host.

If you see this information, it means the operation is successful.

Then you can use php mail (there are a lot of emails on the internet, sorry, you can't upload them, or if you need them, I will paste them later) fill in the "localhost" User email address on the server (the email server variable) (this server [just got this]) enter the username you just added + the domain name filled in local-host-names to be displayed in the recipient (although it may be virtual) for example, the mike@test.com password is just the user's password (this is the smtp mail program to be verified) port is 25 so you can use the server you just set up to send the mail!

I hope you can understand. If you have any questions, please leave a message or give me some email. I have been using this email server for more than a week. It can be said that it was a very failed task. No way, I have a solid foundation and have been forced to help others build websites, I had to learn and explore it in this way. Many articles on the Internet say that we set up servers in linux, but they didn't teach us how to use servers (maybe they don't think so! Or I'm too stupid. Why do I need to mention it in some places? Because these are the shortcomings in sending emails in php: (1) it is very easy to use the mail () function to send emails, the problem is that the recipient is displayed as nobody. In this way, the problem can be solved by setting the local-host-name and/etc/mail/accesss above! In this case, you do not need to use Yahoo or other servers to send emails to the transfer station. (although there is no problem, I have reposted the method. If you are interested, please visit it) why must I use my computer as a server ?? To put it bluntly, it's just the customer's requirement! There is no way, just like how he wants to use ubutun as a server (my personal feeling is not good, but I have never understood it in depth, and I would like to hear from anyone who knows it, would like to know !)

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.