FreeBSD Stable Release 6.0 Installer  Guide

Home______________________________________________________________________

Email Service

FBSD provides email services with its built in SMTP server called sendmail. Sendmail has been the email server of choice by many commercial users for many years. It has the reputation of being hard to configure because of its large number of configuration options. There are books written just about configuring sendmail. FBSD has pre-configured sendmail's options so all sendmail needs to function is a domain name which it gets from the hostname= statement in rc.conf. Sendmail is an MTA (mail transport agent); its function in life is to listen on port 25 for inbound email originating from your LAN users or the public Internet. All email for users of its domain gets posted to the users sendmail mailbox. All email distined for domains on the public Internet gets sent out. Sendmail is the main post-office where the email is stored for all of the FBSD system defined users.

Sendmail defaults to disabled inbound connections from your LAN network. You have to add the following statement to /etc/rc.conf 

sendmail_enable="YES"

If you want your LAN email clients to post their outbound email on the sendmail server then you need to enable it like above.

 

Sendmail can be configured to filter out spam and viruses. See Sendmail spam filtering

The second most popular email server is Postfix. It's know for it's ease of configuring. Postfix is in the FBSD ports collection. See Postfix spam filtering

 

Commercial, Non-Commercial Sendmail Users

The way sendmail receives its email from the public Internet depends on if you are a commercial user or not. Basically what determines that is how you are known to the public Internet. A commercial user has an always on, 24/7, permanently dedicated high-speed leased Internet line connecting them to their ISP and one or more static IP addresses assigned by their ISP. A static IP address is always the same number; it never changes between logins to the ISP. They have an official registered domain name that points to one of the static IP addresses which point to their gateway PC. Their email will arrive at the gateway PC and be processed by the sendmail server directly. Because a commercial user’s email server is online 24/7 the public Internet email always has a place to go. They do not use their ISP to receive and hold their email for them. They also have a POP3 server so their LAN users can retrieve their email from their mailbox on sendmail.

A non-commercial user, like the home user, uses a cable or phone line dial in login to their ISP on a limited speed connection and gets assigned a single dynamic IP address which changes every time they login. Their ISP receives and holds all their email for them. They use their email client software to fetch and send their email through the ISP’s email servers. From the ISP viewpoint non-commercial users use a very small amount of its overall resources and so charges much less for a single user account. Most ISP's close the port numbers used by email servers and web servers to block their non-commercial users from hosting their own web site and email server, because the ISP wants to charge extra for those services.

A non-commercial user with or without a LAN can configure their gateway system to function like a commercial user in a limited way. Most ISP's block port 25 so your sendmail server will not be able to receive inbound email from the public Internet. All inbound email will go to your ISP's email servers. The gateway system can be configured to retrieve the users email from the ISP on a schedule and populate the sendmail server mailboxes. The gateway also needs a POP3 server so its LAN users can retrieve their email from their sendmail mailbox. Then the LAN PC client email software needs to be configured to retrieve the email from the gateway’s pop3 server and send their email through the gateway's sendmail server.

In addition, your sendmail server has to be configured to relay all outbound email to your ISP's email server. In today's world of spam, many ISP's do a port 25 challenge to the emails domain name to verify it's an authentic email server. Since most ISP block inbound port 25 for non-commercial accounts, your email will flagged as spam.

This involves a lot of unnecessary gateway configuration changes and the installing of two third party software applications.

All that is really necessary is to configure the LAN PC's email client software application to retrieve and send their email using their ISP’s individual email accounts. That is the recommended method. Most ISPs allow 5 additional email accounts per each dial in access account, so this should not be a problem.

If you want to configure your email environment like a commercial user, then continue with the following steps.

 

Configure Sendmail To Send Email Through Your ISP


cd /etc/mail/
On  the command line, type:  make
 
This will create some config files prefixed with the hostname you specified
in the rc.conf hostname statement.
 
ee <hostname>.mc
 
Locate the line in the file containing SMART_HOST.
Remove <dnl> from the start of this line to enable it.
In this line replace <your.isp.mail.server> with the name of
your ISP's SMTP server name.

NOTE:  make sure your quotes around the hostname are correct.
 
Save the file and exit.
 
Type:   make && make install && make restart
 
This will compile the <hostname>.mc file, install it into sendmail,
and restart sendmail using this new config file.

 

POP3 Email Server

Sendmail is only half of what is needed for a complete FBSD email solution. A pop3 or imap server is also needed. When a LAN user wants to retrieve his email from the sendmail email server, he uses his email client program which logs into the FBSD POP3 server, which in turns accesses the user's mailbox in sendmail, transmitting its contents back to the user. A POP3 server allows users to access their email using any (Post Office Protocol) POP3 client. Those of you who have configured Microsoft Outlook on Window98/ME/XP machines know that SMTP and POP3 servers are required.

 

Qpopper Application

Qpopper is the most widely-used server for the POP3 protocol (this allows users to access their email using any POP3 client). Qpopper supports the latest standards and includes a large number of optional features. It is normally used with standard UNIX/FBSD mail transfer agents such as sendmail or postfix.

For details see http://www.eudora.com/qpopper/

There is a manual at http://www.eudora.com/qpopper/documentation.html  that describes execution time override configuration file.

The FBSD package of qpopper installs a very basic vanilla environment without any of qpopper's built in high performance options activated. Install the package and configure qpopper for high performance operation.

 

Qpopper Installation Instructions

pkg_add –rv qpopper

rehash

At the completion of the package install a message block is displayed that tells you to copy this statement into the /etc/inetd.conf file to activate qpopper.

You are not going to use that statement as is. You are going to add an option flag to it to enable qpopper to read a configuration option file so its high performance capabilities can be enabled.

Edit the /etc/inetd.conf and place the following pop3 qpopper statement at the front of the file after the info comments and just before the first FTP statement.

pop3 stream tcp nowait root /usr/local/libexec/qpopper qpopper -f /etc/qpopper.conf

 

Now create the qpopper override config file so it contains the following content:

ee /etc/qpopper.conf

# This is the qpopper configuration override file
#
# Mail statistics
# Write info message to log file every time user checks email.
# Uncomment for testing only
#set statistics = true

# Put qpopper in server mode for fast performance
set server-mode = true

# For security purposes do not announce banner showing qpopper version
set shy = true

# Turn on fast updates
set fast-update = true

# Turn off reverse lookup of clients IP address
set reverse-lookup = false

# Put qpopper messages in their own log file.
set log-facility = local2

 

Since you told qpopper to use local2 for logging in the qpopper configuration override file above, you now have to complete the logging environment.

Add this statement to /etc/syslog.conf:

local2.notice     /var/log/qpopper.log

This log file does not exist, so you must create it.

touch /var/log/qpopper.log

Now you must set up log rotation. Add this statement to /etc/newsyslog.conf:

/var/log/qpopper.log 600 3 100 * B

You can change the log rotation triggers to whatever you want.

See man newsyslog for info on what they mean.

To activate the changes to /etc/inetd.conf you can reboot or bump the inetd task into re-reading /etc/inetd.conf by kill –HUP pid. You get the pid (IE: process number) by listing the tasks with the ps ax command. Find inetd in the display and the pid number is the number in the left column.

To activate the changes to /etc/syslog.conf you can reboot or bump the syslog task into re-reading /etc/syslog.conf by kill –HUP pid. You get the pid (IE: process number) by listing the tasks with ps ax command. Find syslogd in the display and the pid id is the number in the left column.

Installer Note: All users defined on the gateway sendmail server system have to belong to the "mail" group, so the qpopper pop3 server can access the user's sendmail mailbox.

 

Configuring Microsoft Outlook for FBSD Email Service

In Outlook click on tools/accounts/add/mail/ to enter a wizard that prompts you to fill in the following fields:

display name = whatever you want to be know by (next button)

email address = bob@fbsdjones.com (next button)

my incoming mail server is = pop3

incoming mail pop3 or imap server = 10.0.10.2

outgoing mail SMTP server = 10.0.10.2 (next button)

You can not use server names here because you do not have a private LAN DNS server to resolve the names to IP addresses, so you use the IP address of the LAN NIC in the FBSD gateway/firewall box.

Account name bob This is the LAN user's account name on the FBSD gateway box.

Password ****** This is the password for the above account name from adduser.

Check mark remember password (next button)

Click on Connect using my Lan (next button)

(finish button) and you return to the account window.

There will be an account named 10.0.10.2 showing. To give this account a meaningful name, highlight 10.0.10.2, click on properties and type over 10.0.10.2 with fbsdjones.com. (apply button) + (ok button). It should be marked as type = default; if not make it so by highlighting it and hitting the default button. Click the close button.

Now create a new email message using Outlook, and send it.

To bob@fbsdjones.com

Then click on send/receive to bring it back.

When you sent it, Windows talked to sendmail who received it and put it in bob's mailbox. When you told windows to retrieve the email it used pop3 protocol to talk to qpopper who looked in bob's mailbox, found the email and shipped it to the windows machine that requested it. If in the windows account, properties, advanced tab, delivery section, you check marked the 'leave copy on server' option, then that's just what qpopper did. If you did not have this option check marked them qpopper waited for Outlook to acknowledge it received all the email sent and then qpopper deleted the email from bob's mailbox in sendmail.

______________________________________________________________________

This FreeBSD Installer Guide is an public domain HOW-TO.  This content may be reproduced, in any form or by any means, and used by all without permission in writing from the author.