0 statement
This article was modified on the basis of the article "setting up a home network email system through Exim", by Jan
W. stumpel, Oegstgeest, The Netherlands.
The address of this chapter is: http: // 211.167.66.225 /~ Yzhao/LG-zh/lg-zh-issue8/stumpel.html
1 Overview
I think an ordinary unit will also need email. My company has reached the point where I can't leave my email. Every time there is a problem with the email server, my phone number will be cracked. On the M $ platform, the mail server market is basically occupied by two software: M $ exchange and Lotus Domino/Notes. The cost of these software is not small. On UNIX platforms, we have a lot of options and they are free of charge.
In Debian, we do not need sendmail or Qmail or Postfix, but use Exim. This is the Debian default mail server, and this software is attached to the basic system. I won't say anything about the reason. In any case, Debian recommends it.
1.1 functions we will implement
◆
Users in the LAN can send and forward local emails.
◆ Emails sent outside the LAN have the correct from: <email address> to allow external emails to reply correctly.
◆
The email account is shared by all local subnet users, but each user must be able to receive only their own emails.
◆ Exim is used as the mail sending and receiving proxy (it is better configured than Sendmail ).
◆ Mail is used as the mail client program for Linux.
◆ Microsoft Outlook Express serves as the Win2000 client email program (you can also use other similar tools, such as Foxmail ).
◆ Qpopper is used as a POP3 server to transfer emails from the Linux system to the Win2000 Server.
◆ Fetchmail is used to receive mails from the Internet.
I did the test on two machines (respectively installing Linux and win2000 systems). Of course, Win9x, NT, and XP can both be used, and if both machines are Linux, they can also be used. This solution should be more than enough for a small and medium-sized office.
1.2 network and naming
In this article, I assume the following names (you should write and modify your actual application to adapt to your actual situation ):
◆ Name of the owner and System Administrator: Kanaka Leng.
◆ Linux machine nameDebian.
◆ Name of Win2000 MachineNotepad. Generally, the user is ganghua Leng.
◆ The registered username of Kanaka on the Debian machine is Kanaka.
◆ The registered username of ganghua on the Debian machine is ganghua.
◆ The registered username of ganghua on the notepad machine is also ganghua.
Her Debian machine in Linux has the same password as Win2000.
◆
Our company's LAN connects to the Internet through broadband. Of course you can also use ordinary dialing.
◆ Both Kanaka and ganghua use an email address: kanaka@yeah.net.
◆ The password for receiving emails from Kanaka to POP3 is kanakapswd.
◆ The mail server sent by the ISP is smtp.yeah.net.
◆ The ISP's email receiving server is pop3.yeah.net.
Both Debian and notepad belong to one domain, with the domain name test.com.
This domain name is used for internal testing. We have not registered this domain name,
Therefore, external networks cannot directly identify this domain name.
In addition, I assume that the internal network is working properly,
In addition, you already have non-permanent dial-up connections or broadband connections implemented using daild.
The DNS service is not installed on the Debian machine. In/etc/resolv. conf, only the addresses of the two DNS servers provided by the ISP are added. The same settings should also be added to the TCP/IP settings on the notepad machine.
1.3 email address
Specifying the email address in "to:" and "from:" is a basic component of an email,
In addition, there is more content. For example:
To: ganghua Leng <kanaka@yeah.net>
'Ganghua leng' is a "real-name part" (real name part ).
This is added by the email writing program.
This part is the basis for sending the email to ganghua. NOTE: If
A period exists in the part, and the email address must be surrounded by a "symbol (for example," Kanaka
C. Leng "). You can use man mailaddr to refer to the Help Page.
2 Installation
We have installed the Debian basic system, and the Debian basic system contains the Exim and mail software. Therefore, we only need to install these two software: fetchmail, fetchmailconf, and Qpopper.
# Apt-Get install fetchmail fetchmailconf qpopper |
Fetchmailconf is a tool used to configure fetchmail.
The system will ask you some questions. If you want to run system-wide as root
In fetchmail, answer yes. Select the default value for all others.
3 Configuration
3.1 configure Debian hosts
The content of the/etc/hosts file on the Debian machine is as follows:
127.0.0.1 localhost 192.168.1.1 debian.test.com Debian 192.168.1.2 notepad.test.com notepad |
3.2 configure Exim
In Debian, all of this is done by the eximconfig program.
The program will ask some questions, you can refer to the following answer:
◆ Your system is an Internet host (select 1, although you are on the LAN. In this way, you can send emails to the Internet ).
◆ "Display email domain name" is test.com.
◆ Does the system have other names? You can answer Debian: localhost.
◆ You do not want to forward any emails from non-local domains. Keep none, and press Enter.
◆ The local IP address you want to forward is 192.168.1.0/16.
◆ The smarthost address used to process the forwarded mail is smtp.yeah.net.
◆ The system administrator's email is Kanaka (not root ).
3.3 configure win2000
3.3.1 hosts
The content in the C:/winnt/system32/Drivers/etc/hosts file on the notepad machine is the same as that in the/etc/hosts file on the Debian machine.
127.0.0.1 localhost 192.168.1.1 debian.test.com Debian 192.168.1.2 notepad.test.com notepad |
3.3.2 Mail Client
In Microsoft Outlook Express (or other such email client programs you use in Win2000 ).
Debian input must both be used as the SMTP mail server and POP3 server. In the POP3 account name and POP3 PASSWORD input boxes,
Enter the username ganghua and her password in Linux. Enter the name ganghua Leng;
The email address is a ganghua@test.com.
Note that the email address must be followed by the address in this region.
4 small tests
Through the above settings, local users should be able to send and reply to each other. In Outlook
I will not talk about the tests in Express. I will talk about using mail for testing on Debian.
# Mail KanakaSubject: This is my first test-mail! Hi, Kanaka, This is the first time that I send a mail by Exim. . HTTP: kanaka@yeah.net # |
We sent an email to the local Kanaka and copied it to the kanaka@yeah.net on the Internet. Note: to end the content of a letter, enter "." In the new line. I used outlook on win2000
Express can receive a letter to Kanaka; and To the kanaka@yeah.net, I go to freemail.yeah.net site, also received.
Now test.com has truly become a local region with the mail forwarding function, and can send mail to the kanaka@yeah.net on the Internet. However, an address in the format of from: kanaka@test.com obviously cannot be replied by external users,
For external networks, test.com is a non-existent (and therefore illegal) domain name. Therefore, we also need to modify the from: address.
5. Modify from: Address
When sending emails to the internet, we must change the local from: address format to a valid email address in order that they can reply correctly.
With the help of Exim's "transfer filter", we can implement this function.
After an external email is forwarded through this transfer filter, from:
The address in is changed, but it has no effect on local emails.
The following filters will implement this dramatic technique,
First, make sure that the address we want to change is always included in the "<>" symbol.
Although it cannot be completely guaranteed, the common mail program is mail or even Microsoft
Outlook Express generates email addresses in this format.
5.1 create an outfit File
Create a file,/usr/bin/outfit. The content is as follows:
#! /Usr/bin/perl While (<stdin> ){ If (/^ From :/){ S/<. *>/<'kanaka @ yeah.net '> /; Print "$ _"; last; } Print "$ _"; } While (<stdin>) {print "$ _";} |
Put this file in the/usr/bin directory and name it "outfit". Do not forget to replace the above email address with your own email address!
Then, run the following command chmod + x/usr/bin/outfit to add executable permissions.
# Chmod + x/usr/bin/outfit |
5.2 modify Exim. conf
Open/etc/Exim. conf and find the following line:
Add the following two lines to it:
Driver = SMTP Headers_remove = "sender" Transport_filter = "/usr/bin/outfilt" |
With the above modification to the/etc/Exim. conf file, the Exim can be correctly shipped whenever an email is sent out of the local region. If you are using a dial-up network, each time an ExIm (via daild) sends an email, it will dial an outbound number. Our company's bandwidth is online 24 hours a day, so emails are sent directly each time.
6 configure fetchmail
Run fetchmailconfig to generate a file named. fetchmailrc in your home directory. Otherwise, you cannot use fetchmail.
Fetchmial retrieves the email from the Internet Mail Server (and transfers it to Exim for local delivery ).
# FetchmailconfigFetchmialconf must be run Under x |
As you can see, it indicates that the program fetchmialconf runs under X. Alas! We need to use Debian as a server, and the server does not need to install x at all. We will not install an X system and a window manager to configure fetchmail! Well, let's write this file manually. It's actually quite simple.
Because we want to receive the email to Kanaka in the local mailbox, we should generate this. fetchmailrc in the main directory of Kanaka, So we switch to the Kanaka user and then perform the operation:
# Su Kanaka$ Cd $ Nano . Fetchmailrc |
Then, enter the following content to save the disk and exit:
Set Postmaster "Postmaster" Poll pop3.yeah.net with Proto POP3 User "kanaka@yeah.net" password "kanakapswd" |
The. fetchmailrc file can be copied between different users, as long as the owner of the file is set as the relevant user. However, it is wise to write the user's email password in an explicit Code in this file.
Maybe there should be a better way. Please tell me, huh, huh.
Then, run the fetchmail command to drag the email from the Internet to the local device:
$ Fetchmail1 message for kanaka@yeah.net Pop3.yeah.net (1648 octets ). Reading message kanaka@yeah.net @ pop3.yeah.net: 1 of 1 (1648 octets ). Flushed |
Then, you can receive these emails locally in Outlook Express of Win2000.
7. Modify the shipping limit of Exim
The maximum number of mails delivered by Exim is 100 by default.
You can modify the value based on your actual unit. If you want to cancel this restriction, change it to 0, but be careful when you are attacked:
Smtp_accept_queue_per_connection = 0 |
8. Comprehensive Test
You can send several more emails to Debian and win2000 for a test.
9 todo
In the next version, we will describe how to use the. forward file to forward the mail to a user, instead of sending the mail to Kanaka all at once.
We will also describe how to create a Webmail system.
10 Conclusion
This article is the third chapter in the series of tutorials "getting started with Debian Server Settings". We recommend that you read this article in sequence. If you have any questions, contact the author Kanaka.
11 references
This article states at the beginning that this article was modified on the basis of the article "setting up a home network email system through Exim", Author: Jan
W. stumpel, Oegstgeest, The Netherlands.
The address of this chapter is: http: // 211.167.66.225 /~ Yzhao/LG-zh/lg-zh-issue8/stumpel.html
This is because this article is too precious for us. Except her, I have not found any other information about Exim.
Thank you very much for the author of the original article and the translator!