Today, email is an important part of many people's life. As there are many options as to how to set it up, and as having it set up correctly is important for some Debian utilities, we will try to cover the basics in this section.
There are three main functions that make up an e-mail system. First there is the Mail User Agent (MUA) which is the program a user actually uses to compose and read mails. Then there is the Mail Transfer Agent (MTA) that takes care of transferring messages from one computer to another. And last there is the Mail Delivery Agent (MDA) that takes care of delivering incoming mail to the user's inbox.
These three functions can be performed by separate programs, but they can also be combined in one or two programs. It is also possible to have different programs handle these functions for different types of mail.
On Linux and Unix systems mutt is historically a very popular MUA. Like most traditional Linux programs it is text based. It is often used in combination with exim or sendmail as MTA and procmail as MDA.
With the increasing popularity of graphical desktop systems, the use of graphical e-mail programs like GNOME's evolution, KDE's kmail or Mozilla's thunderbird has becoming more popular. These programs combine the function of a MUA, MTA and MDA, but can — and often are — also be used in combination with the traditional Linux tools.
Even if you are planning to use a graphical mail program, it would be useful, to have a traditional MTA/MDA installed and correctly set up on your Debian GNU/Linux system. Reason is that various utilities running on the system can send important notices by e-mail to inform the system administrator of (potential) problems or changes.
For this you can install
mutt with apt install exim4 mutt.
exim4 is a combination MTA/MDA that is relatively small but very flexible. By default it will be configured to only handle e-mail local to the system itself and e-mails addressed to the system administrator (root account) will be delivered to the regular user account created during the installation.
When system e-mails are delivered they are added to a file in
/var/mail/. The e-mails can be read using mutt.
As mentioned earlier, the installed Debian system is only set up to handle e-mail local to the system, not for sending mail to others nor for receiving mail from others.
If you would like
exim4 to handle external e-mail, please refer to the next subsection for the basic available configuration options. Make sure to test that mail can be sent and received correctly.
If you intend to use a graphical mail program and use a mail server of your Internet Service Provider (ISP) or your company, there is not really any need to configure
exim4 for handling external e-mail. Just configure your favorite graphical mail program to use the correct servers to send and receive e-mail (how is outside the scope of this manual).
However, in that case you may need to configure individual utilities to correctly send e-mails. One such utility is reportbug, a program that facilitates submitting bug reports against Debian packages. By default it expects to be able to use
exim4 to submit bug reports.
To correctly set up reportbug to use an external mail server, please run the command reportbug --configure and answer “no” to the question if an MTA is available. You will then be asked for the SMTP server to be used for submitting bug reports.
If you would like your system to also handle external e-mail, you will need to reconfigure the
# dpkg-reconfigure exim4-config
After entering that command (as root), you will be asked if you want split the configuration into small files. If you are unsure, select the default option.
Next you will be presented with several common mail scenarios. Choose the one that most closely resembles your needs.
您的系統連接到網路上，並且您透過 SMTP 直接收發郵件。在接下來的幾頁中，程式會詢問您一些基本問題，如：您的機器的郵件名稱、您接受或轉發郵件的網域名稱等等。
In this scenario your outgoing mail is forwarded to another machine, called a “smarthost”, which takes care of sending the message on to its destination. The smarthost also usually stores incoming mail addressed to your computer, so you don't need to be permanently online. That also means you have to download your mail from the smarthost via programs like fetchmail.
In a lot of cases the smarthost will be your ISP's mail server, which makes this option very suitable for dial-up users. It can also be a company mail server, or even another system on your own network.
This option is basically the same as the previous one except that the system will not be set up to handle mail for a local e-mail domain. Mail on the system itself (e.g. for the system administrator) will still be handled.
This is the option your system is configured for by default.
除非您真的知道您在做什麼，否則請不要選擇這一選項。這會留下一個未設定的郵件系統 — 在您再次設定它之前，您都無法收發任何郵件，並且可能會錯過一些系統工具發出的重要資訊。
If none of these scenarios suits your needs, or if you need a finer grained setup, you will need to edit configuration files under the
/etc/exim4 directory after the installation is complete. More information about
exim4 may be found under
/usr/share/doc/exim4; the file
README.Debian.gz has further details about configuring
exim4 and explains where to find additional documentation.
Note that sending mail directly to the Internet when you don't have an official domain name, can result in your mail being rejected because of anti-spam measures on receiving servers. Using your ISP's mail server is preferred. If you still do want to send out mail directly, you may want to use a different e-mail address than is generated by default. If you use
exim4 as your MTA, this is possible by adding an entry in
 Examples are: cron, quota, logcheck, aide, …
 The forwarding of mail for root to the regular user account is configured in
/etc/aliases. If no regular user account was created, the mail will of course be delivered to the root account itself.
 You can of course also remove
exim4 and replace it with an alternative MTA/MDA.