Configure the SMTP server
1. Configure domain files on the dns server
[Root @ server03 named] # vim/var/named/chroot/var/named/example.com. zone
$ TTL 1D
@ In soa @ root.server03.example.com .(
0; serial
1D; refresh
1 H; retry
1 W; expire
3 H); minimum
NS @
A 127.0.0.1
Server03 in a 192.168.4.103
Mail.example.com. in cname server03.example.com.
Example.com in mx 5 mail.example.com
The preceding three items are a complete email record.
[Root @ server03 named] # vim/etc/resolv. conf
# Generated by NetworkManager
Search example.com
Nameserver 192.168.4.103
Detection:
[Root @ server03 named] # nslookup server03.example.com
Server: 192.168.4.103
Address: 192.168.4.103 #53
Name: server03.example.com
Address: 192.168.4.103
[Root @ server03 named] # nslookup mail.example.com
Server: 192.168.4.103
Address: 192.168.4.103 #53
Mail.example.com canonical name = server03.example.com.
Name: server03.example.com
Address: 192.168.4.103
Ii. installation and configuration
[Root @ server03 named] # yum install postfix
[Root @ server03/] # vim/etc/postfix/main. cf
75 rows:
Myhostname = server03.example.com
Line 83:
Mydomain = example.com
Delete comments from lines 98 and 99
Uncomment 113 rows and comment out 116 rows
Uncomment 165 rows and comment out 164 rows
Remove 426 lines of comments
Save and exit
[Root @ server03/] #/etc/init. d/postfix restart
[Root @ server03/] # mail
No mail for wisdom
Send an email by using an MPS queue:
[Root @ server03/] # echo "111111" | mail-s "abc" wisdom@server03.example.com
[Root @ server03/] # mail
Heirloom Mail version 12.4 7/29/08. Type? For help.
"/Var/spool/mail/wisdom": 1 message 1 new
> N 1 root Tue Sep 23 18/594 "abc"
&
You can view the emails sent to the wisdom user.
Q exit
Send an email as another identity:
[Root @ server03/] # su-ftpusr
[Ftpusr @ server03 ~] $ Echo "22222" | mail-s "def" wisdom@server03.example.com
[Root @ server03 ftpusr] # su-wisdom
[Wisdom @ server03 ~] $ Mail
Heirloom Mail version 12.4 7/29/08. Type? For help.
"/Var/spool/mail/wisdom": 2 messages 1 new
1 root Tue Sep 23 19/605 "abc"
> N 2 ftpusr@example.com Tue Sep 23 18/594 "def"
&
You can see the email sent from ftpusr.
Set alias:
Add:
[Root @ server03 mail] # vim/etc/aliases
Harry: ftpusr # indicates that harry's email is sent to the ftpusr user.
[Root @ server03 mail] # postalias/etc/aliases
Make the settings take effect.
Send another email to harry:
[Root @ server03 mail] # echo "123456789" | mail-s "hello harry 2" harry@server03.example.com
View harry's email:
[Root @ server03 mail] # mail-u harry
Heirloom Mail version 12.4 7/29/08. Type? For help.
"/Var/mail/harry": 1 message 1 unread
> U 1 root Tue Sep 23 19/612 "hello harry"
&
I didn't see the new email.
View the ftpusr Email:
[Root @ server03 mail] # mail-u ftpusr
Heirloom Mail version 12.4 7/29/08. Type? For help.
"/Var/mail/ftpusr": 1 message 1 new
> N 1 root Tue Sep 23 18/605 "hello harry 2"
&
The email sent to harry is displayed.
3. Implement forwarding
Installation:
[Root @ server03 mail] # yum install dovecot. i686
Configuration
[Root @ server03 mail] # vim/etc/dovecot. conf
Remove the comments from line 1 to open the three protocols that can be used.
[Root @ server03 mail] # vim/etc/dovecot/conf. d/10-mail.conf
Remove the comments from line 1 and synchronize the email pool to the user's home directory.
Start:
[Root @ server03 mail] #/etc/init. d/dovecot restart
[Root @ server03 mail] # cd/home
[Root @ server03 home] # ls
Admin harry redhat wisdom
[Root @ server03 home] # cd harry/
[Root @ server03 harry] # ls-
... Bash_logout. bash_profile. bashrc. gnome2. mozilla
[Root @ server03 harry] # mkdir mail/. imap/INBOX-p
Install and enable Thunderbird
Enter the identity of harry to log on.
You can see the emails that harry received earlier.
Create a user wisdom
[Root @ server03 harry] # cd ..
[Root @ server03 home] # ls
Admin harry redhat wisdom
[Root @ server03 home] # cd wisdom/
[Root @ server03 wisdom] # mkdir mail/. imap/INBOX-p
Restart thunderbird to view the wisdom email.
4. send and receive emails through a browser
Decompress squirrelmail-webmail-v1.4.22.zip to/var/www/html, and
Content in the squirrelmail-webmail-1.4.22 cp to/var/www/html
[Root @ server03 html] # service httpd start
Enter the local ip address in the browser and you will see:
ERROR: Config file "config/config. php" not found. You need to configure SquirrelMail before you can use it.
[Root @ server03 html] # cd config
[Root @ server03 config] # ls
Config_default.php config_local.php conf. pl index. php
You can modify config_default.php and rename it to config. conf.
Run conf. pl
Some configurations are available.
Save and exit
[Root @ server03 config] # ls
Config_default.php config_local.php config. php conf. pl index. php
See config. php
Refresh the page to see the page
Enter the user to log on and you will see
ERROR
Error opening ../data/default_pref
Cocould not create initial preference file!
/Var/local/squirrelmail/data/shocould be writable by user httpd
Please contact your system administrator and report this error.
These errors.
The squirrelmail Folder does not exist in/var/local.
[Root @ server03 config] # mkdir/var/local/squirrelmail/data-p
[Root @ server03 config] # cd/var/local/squirrelmail
[Root @ server03 squirrelmail] # chown apache. apache data/-R
Refresh the page now you can use the username and password under the server to successfully log on and send emails.