Postfix controls resource usage through specific postfix configuration parameters, we can implement postfix... because this Code uses the mysql client library, we must install the mysql open package.
1. install and configure postfix:
# Netstat-nutlp | grep: 25
#/Etc/rc. d/init. d/sendmailstop
# Chkconfigsendmailoff
# Rpmivhpostfix-... rpm
Ii. install and configure the postfix Service
Main configuration file:/etc/postfix/main. cf
# Vi/etc/postfix
1. Set the mail host name and domain name for running the postfix Service
Myhostname = mail.linux-lab.cn
Mydomain = linux-lab.cn
2. Set the domain name or main phase name of the mail sent by the Local Machine
Myorigin = $ mydomain
3. Set the network interface of the postfix service listener
Inet_interfaces = all
4. Set the host name or domain name for receiving emails:
Mydestination = $ mydomain, $ myhostname
5. set which network mails can be forwarded (Relay.
Mynetworks = 192.168.0.0/24
6. set which domains can be forwarded for mail
Relay_domains = linux-lab.cn
Iii. SMTP authentication Configuration
Currently, the commonly used SMTP authentication mechanism is implemented through the CyrusSASL package.
CyrusSASL is CyrusSimpleAuthenticationandSecurityLayer, which provides the authentication function library for applications.
1. Install the Cyrus-SASL authentication package
[Root @ rhel4postfix] # rpm-qa | grepsasl
Cyrus-sasl-md5-2.1.19-5.EL4
Cyrus-sasl-devel-2.1.19-5.EL4
Cyrus-sasl-2.1.19-5.EL4
Cyrus-sasl-gssapi-2.1.19-5.EL4
Cyrus-sasl-plain-2.1.19-5.EL4
Cyrus-sasl-ntlm-2.1.19-5.EL4
Cyrus-sasl-sql-2.1.19-5.EL4 // I have installed it.
2. Password verification mechanism for Cyrus-SASLV2.
[Root @ rhel4postfix] # saslauthd-v
Saslauthd2.1.19
Authenticationmechanic ISMs: getpwentkerberos5pamrimapshadowldap
# Vi/etc/sysconfig/saslauthd
MECH = shadow // The password used for confirmation is shadow.
3. Cyrus-SASLV2 certification function.
# Psaux | grepsaslauthd view the saslauthd process. If no process is found, enable:
#/Etc/rc. d/init. d/saslauthdstart
# Chkconfigsaslauthdon
#/Usr/sbin/testsaslauthd-unetseek-p '52netseek'
0: OK "Success." // indicates that authentication takes effect.
4. Set Postfix to enable SMTP authentication:
# Vi/etc/postfix/main. cf
I have not found this part.
5. Test whether STMP authentication is enabled for postfix.
4. Start and Stop the postfix service.
/Etc/init. d/postfixstart, stop, restart, reload # chkconigpostfixon
V. Implementation of POP and IMAP mail services:
In RHELAS4, The dovecot and cyrus-imapd floppy disks provide both POP and IMAP
Service.
1. # rpm-qa | grepdovecot
Dovecot-0.99.11-2.EL4.1
# Vi/etc/dovecot. conf
Protocols = pop3pop3s
Pop3_listen = *
#/Etc/rc. d/init. d/dovecotstart
# Chkconfig -- level345dovecoton
2. Install the cyrus-imapd service:
[Root @ rhel4postfix] # rpm-qa | grepcyrus-imapd
Cyrus-imapd-nntp-2.2.12-3.RHEL4.1
Cyrus-imapd-utils-2.2.12-3.RHEL4.1
Cyrus-imapd-devel-2.2.12-3.RHEL4.1
Cyrus-imapd-murder-2.2.12-3.RHEL4.1
Cyrus-imapd-2.2.12-3.RHEL4.1
The basic configuration file of the cyrus-imapd service:
/Etc/sysconfig/cyrus-imapd
/Etc/cyrus. conf
/Etc/imapd. conf
// These configuration files are basically set up. As long as the cryus-imapd service is started, pop and imap services can be provided at the same time. However, postfix does not support cyrus-IMAP by default. To integrate postfix with cyrus-imapd, you must add the following to the master configuration file/etc/postfix/main. cf of postfix:
Mailbox_transport = lmtp: unix:/var/lib/imap/socket/lmtp
# Servicecyrus-imapdstart
# Chkconfigcyrus-imapdon
Note: If the dovecot service has been installed, you should first turn off the dovecot service and start it automatically at startup, or switch the dovecot Service
Uninstall and start the cyrus-imapd service.
4. User email management:
One advantage of Cyrus-IMAP is that it can create an information for each user, and this mailbox can have a hierarchical structure. By default
The cyrus-imap mailbox is located in the/var/spool/imap directory. When creating a mailbox, it is named in the following format:
Mailbox type. name [. Folder name [. Folder name]...
Eg:
The user's main inbox of netseek is user. netseek. the keyword "user" indicates that the information type is user.
Information, netseek is the user account name in linux. If you need to create a sender, garbage bin, and draft box for the user netseek
User. netseek. Send (sender), user. netseek. Trash (garbage bin), user. netseek. Drafts (draft box)
How to create and manage a user email address:
1. Set a password for Cyrus-IMAP Administrator Account:
[Root @ rhel4 ~] # Passwdcyrus
Changingpasswordforusercyrus.
NewUNIXpassword:
RetypenewUNIXpassword:
Passwd: allauthenticationtokensupdatedsuccessfully.
Cyrus-IMAP Administrator Account: cyrus is automatically created after the cyrus-imapd service is installed. Before you create a mail box for the user for the first time,
You must set a password for the access account to authenticate the user identity when managing user information in the future.
2. Use the cyradm management tool to create mail information for the user:/usr/lib/cyrus-imapd directory.
[Root @ rhel4 ~] #/Usr/lib/cyrus-imapd/cyradm-ucyruslocalhost
IMAPPassword:
Localhost. localdomain> createmailboxuser. netseek
Localhost. localdomain> createmailboxuser. netseek. Send
Localhost. localdomain> createmailboxuser. netseek. Trash
Localhost. localdomain> createmailboxuser. netseek. Drafts
Localhost. localdomain> setquotauser. netseek5120 // (kb, 5 M) set the quota:
Quota: 5120
Localhost. localdomain> listquotauser. netseek
STORAGE0/5120 (0%)
Localhost. localdomain> exit
[Root @ rhel4 ~] # Run the su-lcyrus-c/usr/lib/cyrus-imapd/quota // command to view the user's mailbox usage.
Quota % UsedUsedRoot
512000user. netseek
3. Set permissions for the user's email box:
When the Cyrus-IMAP administrator creates a mailbox for a user, only the user has full control permissions on the mail Information:
In Cyrus-IMAP, you can set the user's mailbox permission in six abbreviated forms:
Abbreviated permission description
None
Read content that allows reading information
Post allows reading and posting messages to mailboxes, such as emails)
Append allows reading and inserting information into the mailbox
In addition to the append permission, write also has the permission to delete emails in the information, but does not have the permission to change the mailbox.
All has all permissions.
After user. netseek is created, you can use the deletemailbox command to delete the email address, even if it is the administrator cyrus.
You do not have the permission. To delete it, you must first use the following command to grant the Administrator cyrus full permissions (all)
[Root @ rhel4 ~] #/Usr/lib/cyrus-imapd/cyradm-ucyruslocalhost
IMAPPassword:
Localhost. localdomain> setacluser. netseekcyrusall
Localhost. localdomain> deletemailboxuser. netseek
Localhost. localdomain> listacluser. netseek
Mailboxdoesnotexist
Common cyradm management commands are abbreviated as follows:
Listmailboxlm lists the names of all mailboxes that match the given string:
Createmailboxcm create a new mail box
Deletemailboxdm deletes a mail box and all its folders.
Renamemailboxrenm rename email
Setaclmailboxsam sets the user's access permissions for the mail box
Deleteaclmailobxdam
Listaclmailboxlam lists the access permissions for mail Information
Setquotasq
Listquotalq lists the mail quota.
Vi. Virtual alias domain configuration and user alias Configuration
Configuration of virtual alias domain:
1,/etc/postfix/main. cf
Virtual_alias_domains = 52ulinux.com, 5ulinux.net
Alias_maps = hash:/etc/aliases
2. vi/etc/postfix/virtual is defined as follows:
@ 5ulinux.com@5ulinux.net
Admin@linux-lab.cnnetseek
Stu@linux-lab.cnstu1, stu2, stu3.
Hr@linux-lab.cnhr, hr@163.com
3. Make the configuration file take effect:
Postmap/etc/postfix/virtual
Postfixreload
User alias Configuration:
1. vi/etc/postfix/main. cf
Alias_maps = hash:/etc/aliases
# Vi/etc/aliases
Stu: stu1, stu2, stu3, stu4
Stuall: include:/etc/mail/stuall
Netseek: jincheng. cao
Cnseek@msn.com (cnseek)
2. Make the configuration file take effect:
# Postfix/etc/aliases // it seems that I have an error in this alias.
# Postfixreload
Article out: bbs.linuxtone.org
Edit recommendations]