Linux mail Server (Postfix+dovecot) (iii) Post mail with Maildrop

Source: Internet
Author: User
Tags bz2 dsn dovecot vmail

Linux mail Server (Postfix+dovecot) (iii) Post mail with Maildrop

16. Configure Postfix to deliver mail using Maildrop
Maildrop is a filtering-capable mail delivery agent written in C + + that replaces local MDA and is one of the courier messaging system components. It accepts the information from the standard input and posts it to the user's mailbox; Maildrop can either post the message to the mailboxes format mailbox or post it to the Maildirs format mailbox. At the same time, Maildrop can read the inbound message filtering instructions from the file and decide to send the message to the user's mailbox or forward it to a different address. Unlike Procmail, Maildrop uses structured filtering language, so messaging system administrators can develop their own filtering rules and apply them.

We will use the maildrop instead of the Postfix's own MDA to extend the post-mail anti-virus and anti-spam functions as a basis for this, and you may modify many of the settings in the previous article, making sure that your settings are also modified accordingly.

1, installation maildrop before the preparation

Link the Courier-authlib header file and the library file (refer to the fourth section of part eighth) to the/usr directory (which will be found in this directory when compiling Maildrop):

# ln-sv/usr/local/courier-authlib/bin/courierauthconfig/usr/bin # ln-sv/usr/local/courier-authlib/include/*/usr/ Include
# Vim/etc/ld.so.conf.d/courier-authlib.conf/usr/local/courier-authlib/lib/courier-authlib

# yum Install Pcre-devel-y


2, Installation Courier-unicode
The character set library file, equivalent to the RPM installation of the Courier-authlib-devel package, does not install this will result in compiling the maildrop times wrong:

# wget http://jaist.dl.sourceforge.net/project/courier/courier-unicode/1.1/courier-unicode-1.1.tar.bz2# Tar jxvf COURIER-UNICODE-1.1.TAR.BZ2 # CD courier-unicode-1.1#./configure# make# Make Install
# ls/usr/local/liblibcourier-unicode.a libcourier-unicode.so libcourier-unicode.so.1.0.0 libunicode.la libunicode. so.1libcourier-unicode.la libcourier-unicode.so.1 libunicode.a libunicode.so libunicode.so.1.0.0
# Vim/etc/ld.so.conf.d/courier-unicode.conf/usr/local/lib
# ldconfig-v



3, Installation maildrop-2.7.2

# groupadd-g 1001 vmail# useradd-g vmail-u 1001-m-s/sbin/nologin vmail
# tar jxvf maildrop-2.7.2.tar.bz2# cd maildrop-2.7.2./configure--enable-sendmail=/usr/sbin/sendmail--enable-tr usted-users= ' root vmail '--enable-syslog=1--enable-maildirquota--enable-maildrop-uid=1001--enable-maildr op-gid=1001--with-trashquota--with-dirsync# make # make install


4. Create a new profile/ETC/MAILDROPRC file, first specify the logging location of the Maildrop:

# VIM/ETC/MAILDROPRC


Add to:

Verbose=5logfile "/var/log/maildrop.log" to "$HOME/maildir"


# touch/var/log/maildrop.log # chown Vmail.vmail/var/log/maildrop.log



5, configuration Postfix
Edit MASTER.CF

# VIM/ETC/POSTFIX/MASTER.CF


Enable the following two lines

Maildrop unix-n N--pipe flags=drhu user=vmail argv=/usr/local/bin/maildrop-d ${re Cipient}



Note: When defining transport, the argument line must start with a space, such as the second row in the last two rows, or an error will occur.


Edit MAIN.CF

# VIM/ETC/POSTFIX/MAIN.CF Virtual_transport = Virtual modified to: Virtual_transport = Maildrop



Modify the UID and GID specified in the following two items as appropriate:

Virtual_uid_maps = static:2525 Virtual_gid_maps = static:2525 modified to: virtual_uid_maps = static:1001 Virtual_gid_maps = Stati c:1001


6. Edit/ETC/AUTHMYSQLRC

# VIM/ETC/AUTHMYSQRC Mysql_uid_field 2525 Mysql_gid_field ' 2525 ' changed to: Mysql_uid_field 1001 Mysql_gid_field 1001

Note: Maildrop may report a "Signal 0x06" error report without the modifications here.

7, Edit #/etc/httpd/conf/httpd.conf, modify the running User:

# vim/etc/httpd/conf/httpd.conf If the suEXEC feature is enabled, the Suexecusergroup postfix postfix specified in the virtual host is modified to: Suexecusergroup Vmail Vmail

If the above features are not used, the user after modifying the users and group instructions is Vmail

The following items in the previous article

User Postfixgroup Postfix modified to: User Vmailgroup Vmail

8, the user mail in the directory/var/mailbox and extman temporary directory/tmp/extman The owner and the group designated as Vmail

#chown-R Vmail.vmail/var/mailbox#chown-r Vmail.vmail/tmp/extman

Designate the owner and group of the CGI file as Vmail

# chown-r vmail.vmail/var/www/extsuite/extmail/cgi/# chown-r vmail.vmail/var/www/extsuite/extman/cgi/

9. Modify the Default User ID and group ID in the Extman master configuration file to make sure it is similar to the following

# vim/var/www/extsuite/extman/webman.cfsys_default_uid = 1001sys_default_gid = 1001


10. e-mail delivery

#/etc/init.d/courier-authlib Restart #/etc/init.d/httpd Restart #/etc/init.d/postfix Restart

Next restart Postfix and Apache, after sending the test, if the log records similar to the following entries, the installation is successful

Jul 6 16:36:26 localhost postfix/qmgr[20145]: 02fd42600d2:from=<[email protected]>, size=2292, nrcpt=1 (Queue acti VE) Jul 6 16:36:26 localhost postfix/smtpd[20549]: Disconnect from M15-112.126.com[220.181.15.112]jul 6 16:36:26 Localhos T postfix/pipe[20634]: 02fd42600d2:to=<[email protected]>, Relay=maildrop, delay=0.31, delays=0.2/0/0/0.11, DSN =2.0.0, Status=sent (delivered via Maildrop service)


Test if you can send an e-mail:

# echo "Test" |maildrop-v 9-d [email Protected]maildrop:authlib:groupid=1001maildrop:authlib:userid=1001maildrop:aut Hlib: [email protected], HOME=/VAR/MAILBOX/10FEI3.TOP/ZYZ2, mail= (default) maildrop:changing to/var/mailbox/ 10fei3.top/zyz2message envelope sender=mailer-daemontokenized; tokenized string: "VERBOSE" tokenized =tokenized string: "5" tokenized; tokenized logfiletokenized string: "/var/log/maildrop.log" tokenized; tokenized totokenized string: "$HOME/maildir" tokenized; Tokenized EOF/ETC/MAILDROPRC (2): verbose= "5"


17, Maidrop Problem Solving

Error 1:

Configure:error:pcre.h not Found-install pcre from www.pcre.org


Solve:

# yum Install Pcre-devel-y



Error 2:

Configure:error:The Courier Unicode Library 1.2 appears is installed. Need to install a separate development subpackage, in addition to the main package


Solve:
Installing Courier-unicode
Character Set library file, equivalent to the RPM installation of the Courier-authlib-devel package, do not install this will cause the compilation of Maildrop

# wget http://jaist.dl.sourceforge.net/project/courier/courier-unicode/1.1/courier-unicode-1.1.tar.bz2# Tar jxvf courier-unicode-1.1.tar.bz2# CD courier-unicode-1.1#./configure# make# Make Install

Error 3:

# Maildrop-vmaildrop:error while loading shared libraries:libunicode.so.1:cannot open Shared object file:no such file or directory

Solve:

# ls/usr/local/liblibcourier-unicode.a libcourier-unicode.so libcourier-unicode.so.1.0.0 libunicode.la libunicode. so.1libcourier-unicode.la libcourier-unicode.so.1 libunicode.a libunicode.so libunicode.so.1.0.0
# Vim/etc/ld.so.conf.d/courier-unicode.conf/usr/local/lib
# ldconfig-v


Error 4:

Jul 6 14:27:58 localhost postfix/pipe[19853]: 531ae260200:to=<[email protected]>, Relay=maildrop, delay=1057, Del ays=1057/0.01/0/0.07, dsn=4.3.0, status=deferred (temporary failure. Command output:/usr/local/bin/maildrop:unable To change to home directory.
# echo "Test" |maildrop-v 10-d [email Protected]maildrop:authlib:groupid=1001maildrop:authlib:userid=1001maildrop:au Thlib: [email protected], HOME=/VAR/MAILBOX10FEI3.TOP/ZYZ2, mail= (default) maildrop:changing to/var/ Mailbox10fei3.top/zyz2maildrop:unable to change to home directory.

Solve:

Check/ETC/AUTHMYSQLRC Mysql_home_field concat ('/var/mailbox/', Homedir) Mysql_maildir_field concat ('/var/mailbox/', MA Ildir) I caused MAILDIR because it was configured as Mysql_maildir_field concat ('/var/mailbox ', maildrop:authlib): [email protected], home=/var/ MAILBOX10FEI3.TOP/ZYZ2, mail= (default)

Error 5:

Jul 6 14:35:59 localhost postfix/pipe[20149]: aae7c260202:to=<[email protected]>, Relay=maildrop, delay=0.28, Del ays=0.25/0/0/0.03, dsn=4.3.0, status=deferred (temporary failure. Command output:/usr/local/bin/maildrop:unable to open mailbox. )
# echo "Test" |maildrop-v 9-d [email Protected]maildrop:authlib:groupid=1001maildrop:authlib:userid=1001maildrop:aut Hlib: [email protected], HOME=/VAR/MAILBOX/10FEI3.TOP/ZYZ2, mail= (default) maildrop:changing to/var/mailbox/ 10fei3.top/zyz2message envelope sender=mailer-daemontokenized; tokenized string: "VERBOSE" tokenized =tokenized string: "5" tokenized; tokenized logfiletokenized string: "/var/log/maildrop.log" tokenized; tokenized; Tokenized EOF/ETC/MAILDROPRC (2): verbose= "5" maildrop:unable to open mailbox.


Solve:

To "$HOME $default" instead: to "$HOME/maildir" # VIM/ETC/MAILDROPRC #SHELL = "/bin/sh" Verbose=5logfile "/var/log/maildrop.log "To" $HOME/maildir "


Linux mail Server (Postfix+dovecot) (iii) Post mail with Maildrop

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.