[root@mailwestos mail]# su - student
[student@mailwestos ~]$ ls -a
. .. .bash_logout .bash_profile .bashrc .cache .config .ssh
[student@mailwestos ~]$ logout
[root@mailwestos mail]# cd /etc/skel/
[root@mailwestos skel]# ls -a
. .. .bash_logout .bash_profile .bashrc .config .mozilla
[root@mailwestos skel]# mkdir mail/.imap/ -p
[root@mailwestos skel]# touch mail/.imap/INBOX
[root@mailwestos skel]# cd
[root@mailwestos ~]# useradd lee
[root@mailwestos ~]# su - lee
[lee@mailwestos ~]$ ls
mail
[lee@mailwestos ~]$ cd mail/
[lee@mailwestos mail]$ ls -a
. .. .imap
[lee@mailwestos mail]$ cd .imap/
[lee@mailwestos .imap]$ ls
INBOX
[lee@mailwestos .imap]$ ll
total 0
-rw-r--r--. 1 lee lee 0 Dec 3 00:15 INBOX
[lee@mailwestos .imap]$ logout
[root@mailwestos ~]# passwd lee
Changing password for user lee.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@foundation15 ~]# mutt -f pop://lee@172.25.254.215
-- Mutt: SSL Certificate check (certificate 1 of 1 in chain)
(r)eject, accept (o)nce, (a)ccept always
##按"o"
-- Mutt: SSL Certificate check (certificate 1 of 1 in chain)
Password for lee@172.25.254.215:
##进入
q
##退出
五.安装thunderbird
[root@maillinux postfix]# yum install lftp -y
......
[root@maillinux postfix]# cd /mnt
[root@maillinux postfix]# lftp 172.25.254.250
lftp 172.25.254.250:~> cd /pub/docs/software
cd ok, cwd=/pub/docs/software
lftp 172.25.254.250:/pub/docs/software> ls
-rwxr-xr-x 1 1000 1000 3086326 Dec 25 2013 phpMyAdmin-2.11.3-all-languages.tar.bz2
-rwxr-xr-x 1 1000 1000 4548030 Dec 25 2013 phpMyAdmin-3.4.0-all-languages.tar.bz2
-rw-rw-r-- 1 1000 1000 2713600 Jun 07 2015 taobao.tar
-rwxr-xr-x 1 1000 1000 52387876 Feb 01 2015 thunderbird-31.2.0-1.el7.x86_64.rpm
-rwxr-xr-x 1 1000 1000 36902724 Feb 01 2015 thunderbird-31.4.0.tar.bz2
lftp 172.25.254.250:/pub/docs/software> get thunderbird-31.4.0.tar.bz2
36902724 bytes transferred
lftp 172.25.254.250:/pub/docs/software> quit
[root@maillinux mnt]# ls
thunderbird-31.4.0.tar.bz2
[root@maillinux mnt]# tar jxf thunderbird-31.4.0.tar.bz2
[root@maillinux mnt]# ls
thunderbird thunderbird-31.4.0.tar.bz2
[root@maillinux mnt]# cd thunderbird/
[root@maillinux thunderbird]# ls
application.ini libldif60.so libxul.so
blocklist.xml libmozalloc.so mozilla-xremote-client
chrome libmozsqlite3.so omni.ja
chrome.manifest libnspr4.so platform.ini
components libnss3.so plugin-container
crashreporter libnssckbi.so precomplete
crashreporter.ini libnssdbm3.chk removed-files
defaults libnssdbm3.so run-mozilla.sh
dependentlibs.list libnssutil3.so searchplugins
dictionaries libplc4.so Throbber-small.gif
extensions libplds4.so thunderbird
icons libprldap60.so thunderbird-bin
isp libsmime3.so updater
libfreebl3.chk libsoftokn3.chk updater.ini
libfreebl3.so libsoftokn3.so update-settings.ini
libldap60.so libssl3.so
[root@maillinux thunderbird]# ./thunderbird
-bash: ./thunderbird: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
[root@maillinux thunderbird]# yum whatprovides /lib/ld-linux.so.2
Loaded plugins: langpacks
rhel_dvd/filelists_db | 3.0 MB 00:00
glibc-2.17-55.el7.i686 : The GNU libc libraries
Repo : rhel_dvd
Matched from:
Filename : /lib/ld-linux.so.2
[root@mailwestos ~]# mail -u westos
Heirloom Mail version 12.5 7/5/10. Type ? for help.
"/var/mail/westos": 2 messages 1 unread
1 root Sat Dec 3 00:40 22/669 "111"
>U 2 lee Sat Dec 3 00:46 22/750 "222"
& 2
Message 2:
From lee@westos.com Sat Dec 3 00:46:50 2016
Return-Path:
X-Original-To: westos@westos.com
Delivered-To: westos@westos.com
Date: Sat, 03 Dec 2016 00:46:50 -0500
From: lee
User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0
To: westos@westos.com
Subject: 222
Content-Type: text/plain; charset=utf-8; format=flowed
X-UID: 2
Status: RO
222
222
& q
Held 2 messages in /var/mail/westos
[root@foundation15 ~]# telnet 172.25.254.215 110
Trying 172.25.254.215...
Connected to 172.25.254.215.
Escape character is '^]'.
+OK [XCLIENT] Dovecot ready.
user student
+OK
pass student
-ERR [SYS/PERM] Permission denied
Connection closed by foreign host.
##权限不够
[root@foundation15 ~]# telnet 172.25.254.215 110
Trying 172.25.254.215...
Connected to 172.25.254.215.
Escape character is '^]'.
+OK [XCLIENT] Dovecot ready.
user lee
+OK
pass lee
+OK Logged in.
quit
+OK Logging out.
Connection closed by foreign host.
六.==smtp连接mysql==
107 yum install httpd php php-mysql -y
108 yum instal lftp
109 yum install lftp -y
110 yum install mariadb-server.x86_64 -y
[root@mailwestos ~]# cd /var/www/html/
[root@mailwestos ~]# lftp 172.25.254.250
lftp 172.25.254.250:~> cd /pub/docs/software
cd ok, cwd=/pub/docs/software
lftp 172.25.254.250:/pub/docs/software> ls
-rwxr-xr-x 1 1000 1000 3086326 Dec 25 2013 phpMyAdmin-2.11.3-all-languages.tar.bz2
-rwxr-xr-x 1 1000 1000 4548030 Dec 25 2013 phpMyAdmin-3.4.0-all-languages.tar.bz2
-rw-rw-r-- 1 1000 1000 2713600 Jun 07 2015 taobao.tar
-rwxr-xr-x 1 1000 1000 52387876 Feb 01 2015 thunderbird-31.2.0-1.el7.x86_64.rpm
-rwxr-xr-x 1 1000 1000 36902724 Feb 01 2015 thunderbird-31.4.0.tar.bz2
lftp 172.25.254.250:/pub/docs/software> get phpMyAdmin-3.4.0-all-languages.tar.bz2
4548030 bytes transferred
lftp 172.25.254.250:/pub/docs/software> quit
[root@mailwestos html]# ls
phpMyAdmin-3.4.0-all-languages.tar.bz2
[root@mailwestos html]# tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2
[root@mailwestos html]# ls
phpMyAdmin-3.4.0-all-languages phpMyAdmin-3.4.0-all-languages.tar.bz2
[root@mailwestos html]# rm -fr phpMyAdmin-3.4.0-all-languages.tar.bz2
[root@mailwestos html]# mv phpMyAdmin-3.4.0-all-languages/ myadmin
[root@mailwestos html]# cd myadmin/
[root@mailwestos myadmin]# cp -p config.sample.inc.php config.inc.php
[root@mailwestos myadmin]# vim config.inc.php
17 $cfg['blowfish_secret'] = 'westos'; /* YOU MUST FILL IN THIS FOR COOKIE AU TH! */
[root@mailwestos myadmin]# systemctl start httpd
[root@mailwestos myadmin]# systemctl start mariadb
[root@mailwestos myadmin]# mysql_secure_installation
密码:westos
[root@mailwestos myadmin]# systemctl restart mariadb
[root@mailwestos myadmin]# cd
[root@mailwestos ~]# firefox &
配置email库muser表4个字段
插入一行用户信息
表用户的域一定要和本机的域 区分开
root@mailwestos ~]# mysql -uroot -pwestos
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 19
Server version: 5.5.35-MariaDB MariaDB Server
Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> CREATE USER postfix@localhost identified by 'postfix';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT INSERT,UPDATE,SELECT on email.* to postfix@localhost;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit
Bye
[root@mailwestos ~]# mysql -upostfix -ppostfix
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 20
Server version: 5.5.35-MariaDB MariaDB Server
Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
修改数据库maildir字段
[root@mailwestos postfix]# mysql -upostfix -ppostfix
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 48
Server version: 5.5.35-MariaDB MariaDB Server
Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
[root@mailwestos ~]# mail admin@westos.org
Subject: test
test
.
EOT
[root@mailwestos ~]# mailq
Mail queue is empty
[root@mailwestos ~]# cd /home
[root@mailwestos home]# ls
lee student vmail westos
[root@mailwestos home]# cd vmail
[root@mailwestos vmail]# ls
mail westos.org ##哪来的mail,应该只有westos.org
[root@mailwestos vmail]# cd westos.org/
[root@mailwestos westos.org]# ls
admin
[root@mailwestos westos.org]# cd admin
[root@mailwestos admin]# ls
cur new tmp
[root@mailwestos vmail]# cd /etc/dovecot/
[root@mailwestos dovecot]# ls
conf.d dovecot.conf
[root@mailwestos dovecot]# cd conf.d/
[root@mailwestos conf.d]# ls
10-auth.conf 20-imap.conf auth-dict.conf.ext
10-director.conf 20-lmtp.conf auth-ldap.conf.ext
10-logging.conf 20-pop3.conf auth-master.conf.ext
10-mail.conf 90-acl.conf auth-passwdfile.conf.ext
10-master.conf 90-plugin.conf auth-sql.conf.ext
10-ssl.conf 90-quota.conf auth-static.conf.ext
15-lda.conf auth-checkpassword.conf.ext auth-system.conf.ext
15-mailboxes.conf auth-deny.conf.ext auth-vpopmail.conf.ext
[root@mailwestos conf.d]# vim 10-auth.conf
122 !include auth-system.conf.ext
123 !include auth-sql.conf.ext
[root@mailwestos conf.d]# vim auth-sql.conf.ext
8 # Path for SQL configuration file, see example-config/dovecot-sql.conf.e xt
[root@mailwestos conf.d]# cd /usr/share/doc/dovecot-2.2.10/
[root@mailwestos dovecot-2.2.10]# ls
AUTHORS COPYING.LGPL dovecot-openssl.cnf NEWS wiki
ChangeLog COPYING.MIT example-config README
COPYING documentation.txt mkcert.sh solr-schema.xml
[root@mailwestos dovecot-2.2.10]# cd example-config/
[root@mailwestos example-config]# ls
conf.d dovecot-dict-auth.conf.ext dovecot-ldap.conf.ext
dovecot.conf dovecot-dict-sql.conf.ext dovecot-sql.conf.ext
[root@mailwestos example-config]# cp dovecot-sql.conf.ext /etc/dovecot/
[root@mailwestos example-config]# cd /etc/dovecot/
[root@mailwestos dovecot]# ls
conf.d dovecot.conf dovecot-sql.conf.ext
[root@mailwestos dovecot]# vim dovecot-sql.conf.ext
32 driver = mysql
71 connect = host=localhost dbname=email user=postfix password=postfix
78 default_pass_scheme = PLAIN
107 password_query = \
108 SELECT username, domain, password \
109 FROM muser WHERE username = '%u' AND domain = '%d'
125 user_query = SELECT maildir, 666 AS uid, 666 AS gid FROM muser WHERE username = '%u'
[root@mailwestos dovecot]# cd conf.d/
[root@mailwestos conf.d]# vim 10-mail.conf
30 mail_location = maildir:/home/vmail/%d/%n
168 first_valid_uid = 666
175 first_valid_gid = 666
[root@mailwestos conf.d]# systemctl restart dovecot.service
[root@mailwestos conf.d]# yum install telnet -y
[root@mailwestos conf.d]# telnet 172.25.254.215 110
Trying 172.25.254.215...
Connected to 172.25.254.215.
Escape character is '^]'.
-ERR Disconnected: Auth process broken
Connection closed by foreign host.
[root@mailwestos conf.d]# tail -n 5 /var/log/maillog
发现
Dec 3 03:53:30 maillinux dovecot: auth: Fatal: Unknown database driver 'mysql'
[root@mailwestos conf.d]# yum search dovecot
Loaded plugins: langpacks
============================ N/S matched: dovecot ============================
dovecot-mysql.x86_64 : MySQL back end for dovecot
dovecot-pgsql.x86_64 : Postgres SQL back end for dovecot
dovecot-pigeonhole.x86_64 : Sieve and managesieve plug-in for dovecot
dovecot.i686 : Secure imap and pop3 server
dovecot.x86_64 : Secure imap and pop3 server
Name and summary matches only, use "search all" for everything.
[root@mailwestos conf.d]# yum install dovecot-mysql -y
......
[root@mailwestos conf.d]# systemctl restart dovecot.service
[root@mailwestos conf.d]# telnet 172.25.254.215 110
Trying 172.25.254.215...
Connected to 172.25.254.215.
Escape character is '^]'.
+OK [XCLIENT] Dovecot ready.
user admin@westos.org
+OK
pass 123
+OK Logged in.
quit
+OK Logging out.
Connection closed by foreign host.
[root@mailwestos conf.d]# telnet 172.25.254.215 110
Trying 172.25.254.215...
Connected to 172.25.254.215.
Escape character is '^]'.
+OK [XCLIENT] Dovecot ready.
user lee@westos.org
+OK
pass 123
+OK Logged in.
quit
+OK Logging out.
Connection closed by foreign host.