Linux Build postfix Mail Service

Source: Internet
Author: User
Tags nameserver

Postfix why things, see: Http://zh.wikipedia.org/wiki/Postfix

0. About Postfix

The postfix was created to replace the traditional sendmail. Compared to Sendmail,postfix in speed, performance and stability are better. Now a lot of mainstream mail service is actually using Postfix. Postfix is an option when we need a lightweight mail server.

1. Postfix is free of charge:
Postfix wants to function in a wide range of Internet users, trying to influence most e-mail systems on the Internet, so it is free.
2. Faster:
Postfix is about three times times faster than SendMail in performance. A desktop PC running Postfix can send and receive millions of e-mails per day.
3. Good compatibility:
The postfix is sendmail compatible, allowing SendMail users to easily migrate to postfix. Postfix supports/var[/spool]/mail,/etc/aliases, NIS, and ~/.forward files.
4. More robust:
The postfix is designed to work properly under heavy loads. When the system is running out of available memory or disk space, Postfix automatically reduces the number of running processes. When the number of messages processed increases, the process that Postfix runs does not follow.
5. More flexible:
Postfix is made up of more than a dozen small programs, each of which completes a specific function. You can
Set the run parameters for each program through the configuration file.
6. Security
The postfix has a multi-layered defense structure that can be used to effectively protect against malicious intruders. For example, most postfix programs can run under lower permissions, cannot access security-related local delivery programs over the network, and so on.

Here's how to build and configure the Postfix service on Linux:


1. To switch off all services related to SendMail, it is best to uninstall SendMail directly.

# Service SendMail Stop
# chkconfig SendMail off

#rpm-qa | grep SendMail | Xargs rpm-e


2. Install the postfix.

redhat6.0 the above version should be the default integration of the Postfix service, if not installed, can be installed manually.

Rpm-qa | grep postifx (see if it's installed)

Yum install Postfix


3. After the installation is complete, modify the configuration file:/etc/postfix/main.cfg


Vi/etc/postfix/main.cf


Myhostname = sample.test.com← Sets the hostname of the system


MyDomain = test.com← Set the domain name (we will let this be set to be the part after the e-mail address "@")


Myorigin = $mydomain ← Set the part after the address "@" to the domain name (not the system host name)


Inet_interfaces = all← Accept requests from all networks


mydestination = $myhostname, localhost. $mydomain, localhost, $mydomain ← Specify the domain name to send to local mail


Home_mailbox = maildir/← Specify user mailbox Directory


< save exit! >


4. Add DNS server for this machine.

Why is DNS Server? Because in the mail sending process, need to address the domain address of the e-mail to the IP address, and then sent to the corresponding recipient, here is related to the DNS of a record and MX records relevant knowledge, unfamiliar classmates can Google or Baidu brain repair:-)


How do I add DNS server, where does DNS server go looking?

Vim/etc/resolv.conf

Add the following line:

NameServer 8.8.8.8

NameServer 8.8.4.4


The above 8.8.8.8/8.8.4.4 is Google free DNS server, of course, there are a lot of complimentary DNS server for everyone to use, you can Google a bit:-)


5. Test whether the message can be sent successfully:

Command line Input $: > echo "Mail Content" | mail-s "Mail Subject" [email protected]


6. Check log to confirm email status:

The log location of the postfix message is:/var/log/maillog

If sent successfully, will return 250 and OK, also can go to own mail client to check.


Everything OK, that postfix Mail Service should be built successfully.


&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&

Other useful postfix maintenance commands, one-time routine inspection and maintenance:

MAILQ : Lists all messages that are currently in the Postfix send queue

postsuper-dAll: Deletes all messages that are currently waiting to be sent, including sending a failed return letter

Of course, there are many, do not list, we can search online extension,good luck!



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.