In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, the editor will share with you the relevant knowledge points about how to configure Postfix email in Linux. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look.
Deploy DNS server
Postfix makes a MX record, A record and PTR record according to the domain name and address (generally, mail servers on the Internet have to decrypt it, no PTR record will be regarded as spam)
$service iptables stop$ chkconfig iptables on$ setenforce 0$ hostname mail.ywnds.com$ echo "127.0.0.1 mail.ywnds.com" > > / etc/hosts$ yum install bind bind-utils bind-libs
Configure DNS
$cat / etc/named.confoptions {listen-on port 53 {any;}; directory "/ var/named"; allow-query {any;}; recursion yes; {zone "ywnds.com" IN {type master; file "ywnds.com";}; # include "/ etc/named.root.key"
PS: just add and modify the above.
$cat / var/named/ywnds.com$TTL 1D @ IN SOA ns.ywnds.com. Root.ywnds.com. (0; serial 1D; refresh 1H; retry 1W; expire 3H) Minimum@ IN NS nsns IN A 192.168.60.10 @ IN MX 10 smtpsmtp IN A 192.168.60.10pop3 IN A 192.168.60.10mail IN A 192.168.60.10$ service named restart$ chkeconfig named onpostfix main configuration file adds the following
The postfix main configuration file is modularized, where:
/ etc/postfix/main.cf: this file holds global configuration information, which is used by all processes unless these configurations are reset in the master.cf file. / etc/postfix/master.cf: this file holds additional process runtime environment parameters, and the configuration defined in the main.cf file may be overwritten by the configuration in this file.
All parameters in the configuration file must be written at the top or they will be treated as a continuation of the previous line of parameters. In addition, most of the postfix configuration files are defaulted and can be viewed using postconf-d.
$cat / etc/postfix/main.cfinet_protocols = allinet_interfaces = 192.168.60.10127.0.0.1myhostname = mail.ywnds.commydomain = ywnds.commyorigin = $mydomainmydestination = $myhostname, localhost.$mydomain, localhost, $mydomainmynetworks = 127.0.0.0/8message_size_limit = 20485760mailbox_size_limit = 5097152000show_user_unknown_table_name = nobounce_queue_lifetime = 1dmaximal_queue_lifetime = 1dhome_mailbox = Maildir/#home_mailbox = Mailbox#mailbox_command = / some/where/procmail
Parameter explanation:
Inet_protocols = all# specifies the protocol. Inet_interfaces = 192.168.60.10127.0.0.specifies the network interface on which the postfix system is listening. Myhostname = mail.ywnds.com# specifies the hostname. Mydomain = ywnds.com# specifies the domain name, and by default postfix removes the first part of myhostname as the value of mydomain. Myorigin = $mydomain# is used to automatically complete the local domain user, to indicate the sender's domain name, that is, to disguise the sending address. Mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain# this defines the domain name of the recipient when the Postfix receives the mail, that is, which domain name the Postfix wants to receive, and those that are not in this area are regarded as relay emails. If you do not add $mydomain, then you are not allowed to receive mail in this domain. Mynetworks = 127.0.0.0 postfix relay is given to your entire network by default according to the network address relay. The system distinguishes whether the user is remote or local according to its value. Here, the setting is only for local relay. Message_size_limit = 20485760mailbox_size_limit = 5097152000show_user_unknown_table_name = no# message size limit is 20m, mailbox size limit is 5G. Bounce_queue_lifetime = 1dmaximal_queue_lifetime = 1d# queue timeout limit is 1 day. Home_mailbox = Maildir/home_mailbox = Mailbox
# there are two methods for mailbox delivery: one is Mailbox, in which all email contents of the same user are stored as a single file, and the file name is usually the same as the user name in the / var/spool/mail/ directory (Postfix is used by default); the second is Maildir, where each user uses a folder and each email is stored as a separate file even if the directory structure is used to store the user's email content. The access speed and efficiency of Maildir mode is better, which is more convenient for managing email content pages.
Mailbox_command = / some/where/procmail
# here you can configure MDA to use procmail (the default delivery agent for postfix).
Pay attention to the problem
1. Parameter lines and comment lines cannot be on the same line in the configuration file of postfix
2. The value of any parameter does not need to be in quotation marks, otherwise, the quotation marks will be used as part of the parameter value.
3. Execute postfix reload after each modification of the parameter and its value to make it effective, but if you modify the inet_interfaces, you need to restart postfix
4. If there are multiple values for a parameter, you can put them on different lines by placing an extra space in front of each subsequent line. Postfix regards the text line with the first character as a space or tab as a continuation of the previous line.
SMTP protocol send email command SMTP status code: 1xx: pure message 2xx: correct 3xx: the previous step has not been completed, you need to continue to supplement 4xx: temporary error 5xx: permanent error
The SMTP protocol is so simple that it allows any user to send mail as well as to any user. The address can be specified at will in the sender (MAIL FROM). However, the recipient (RCPT TO) can be sent to users in this domain or to other domain users through relay. Such as 163or QQ Mail. However, in general, the public network mailbox needs reverse resolution of the sender's domain name. If it can be parsed, the email will be received, and if it cannot be parsed, the email will be lost. If full resolution is a bit too demanding, you can also resolve for some domain names. If you don't believe it, you can change the sender to xxx@taobao.com and see if your recipient can still receive the email. (if you enter an error message, you can press Ctrl plus Backspace.)
By default, Postfix allows relaying on this machine and all hosts on the local network, so you can send mail to other domains. But since we are using the command "mynetworks = 127.0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 8" above, it means that it is only given to the local relay. Therefore, other hosts cannot send messages to other domains, as shown below:
Note: 127.0.0.1 and 192.168.60.10 can access the local machine, but their meanings are different. 127.0.0.1 is inside the machine, while 192.168.60.10 is through the network card. In addition, check the log information of the mail server at / var/log/maillog
Create two mailboxes to test the user and give the password (password is also the same user name) $useradd-s / sbin/nologin openstack$ useradd-s / sbin/nologin hadoop
Mail alias
Mail aliases can transfer messages sent to one user to another, and the user alias format can be defined in the / etc/aliases file as follows:
Openstack: root
Indicates that all messages sent to Openstack users are sent to root users. But Postfix will not use this file because the retrieval in the text file is too slow, so it needs to be converted to another format / etc/aliases.db through hash encoding (postfix supports hash format), and the newaliases command can transcode each other between them, just execute the command newaliases.
Mail queue
Postfix maintains two queues: the pending mail queue (pending mails queue) and the waiting mail queue (deferred mail queue). The waiting queue contains messages that have temporarily failed to be sent and need to be resent, and Postfix will resend them regularly (default is 5 minutes, which can be customized).
Actually, Postfix maintains five queues:
Enter the queue, messages enter the first station of the Postfix system; active queue, qmgr moves messages in the input queue to the active queue; wait in the queue to save messages that cannot be sent temporarily; failure queues to save damaged or unreadable messages; keep queues to keep messages in the Postfix queue system indefinitely; list mail queues $postqueue-p delete all queued messages $postsuper-d ALL deferred delete all messages stsuper-d ALL
PS: you can also use tail / var/log/maillog to view mail queue log information when sending a message. For example, "status=sent" indicates that the message was sent successfully, while "status=deferred" indicates that the message is waiting in the queue.
These are all the contents of the article "how to configure Postfix email delivery in Linux". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.