When you set a mail system you minimaly need 2 things: a smtp server and a pop server.

A Simple Mail Transfer Protocol (SMTP) server will relay mails, meaning it receives them AND sends them also. On your Freesco, you will need to tell exim that it can only serve your.dyndns.org mails or, otherwise, you'll have a public mail relayer and spammers just loves that. Knowing it is serving for that domain, when it receives mail for whateva@your.dyndns.org, it will send it to a local user on Freesco. So you send mail to your smtp server, it will forward it to the recipients smtp server. smtp server receive a mail for a local user and put the message in his mailbox.

Now, when your mail gets in your mailbox, you want to be able to retreive it from a remote machine, right? Well, a Post Office Protocol server permits you to do just that. Using a username/password (usualy the same as when you log to the terminal), you connect to the pop server with a mail client and the server will send you your mail.

Note that you can telnet to both servers. telnet your.dyndns.org , 25 for the smtp and 110 for the pop.
See telnet smtp and telnet pop for a list of commands.

This is the minimalistic setup. Over that, you can add have a local Mail User Agent (MUA) to send and recieve mail from within Freesco. There is Fetchmail to retreive the content of remote mailboxs into your local system. There is fowarding. There are a couple of things.
You'll have more then you bargained for :p

What you need to do is understand how the software packages rely on one another:EXIM + POPA3D = 'MAIL SERVER' and how one won't work without the other.

FOR THE NEWBIES like myself that need to have some things spelled out.
Popa3d (or Qpopper) like mentioned previously is a POP3 SERVER, another way to think of this, is, it is the communication WIRE between EXIM THE MAIL SERVER and an email client.

There has been a problem reported with this package that can cause the system to hang and eventually stop working if you have deleted the root account and replaced it by another account with root privileges.
You should not install this package (exim 4.50) in this case.

IMPORTANT : If you plan on using also the perl package (for spamassassin) you must install perl before exim. Otherwise it will not work.

Exim

Exim is a message transfer agent (MTA) with well-documented, extensive features. It handles the sending of local and remote mail. There is a great deal of flexibility in the way mail can be routed, and there are extensive facilities for checking incoming mail.

Exiscan

Exiscan is a patch against exim version 4.x, now included in the source code in version 4.50, providing support for content scanning in email messages received by exim. It works after the sending client has completed the SMTP data phase and waits for an answer from the server. Messages containing unwanted content can be rejected at that stage, so the job of generating a bounce message is the job of the sending host.
Four different scanning facilities are supported:
- antivirus
- antispam
- regular expressions
- file extensions
(see below “extra packages”)

The latest exim version (4.50) can be found atFreescosoft.
For more info about this package look at this post in the forum.
To install it, you can simply use :

To configure exim you need to edit the main config file /etc/exim.conf.

Before you do, first make a backup of the original config file; before you start editing with your favourite text editor (vi, joe, mc, teddy).

To edit the file you can simply type :edit /etc/exim.conf
(followed by <enter>)

There are four important points not to miss in the config file :

1. The primary hostname

Scroll down the file and search for this line :

primary_hostname = router.inet

This indicates what emails going out of your box will have as a domain.
You need to replace router.inet and put instead your dynamic hostname.
This can be a domain obtained from a dynamic DNS service like dyndns or no-ip.
In my case my hostname is freesco.zapto.org so I put it like this :

It is usefull to put your LAN IP RANGE(s) here if you want to send mail out from
any account, without needing to use SMTP AUTH (having to use a Freesco name and password to be able to send mail).
Simply replace your.dynamic.hostname with your LAN IP RANGE(s) (but leave the 127.0.0.1 !), separated by ':' (column).

R: put a /16 at the end of the range.

If for instance you use 192.168.0.x addresses in your network, it should look like :

hostlist relay_from_hosts = 127.0.0.1 : 192.168.0.0/16

Ok!, now save the config file with <alt+x, y> and restart exim by typing :

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

IMPORTANT :
You must set an aliase for the root user in /etc/aliases, because for safety reasons no mails will be delivered to root. This reason may cause frozen messages.
Here is how you can do :
Edit /etc/aliases with :
edit /etc/aliases
Search for these lines :

You need to add identities to your email client corresponding to the new users added to FREESCO.
Then set the outgoing mail server and incoming mail server in your identities configurations to use your FREESCO domain (your dyndns/no-ip address).

An example of my email address is webmaster@freesco.zapto.org

Try sending an email using one identity and receive it using another identity. It should work like a charm.

Now you can receive and send mails using your FREESCO box!

Advanced…

For more advanced things to do with your new email server, keep reading…

Fetchmail is a full-featured, robust, well-documented remote-mail retrieval and forwarding utility intended to be used over on-demand TCP/IP links (such as PPP connections). It supports every remote-mail protocol now in use on the Internet: POP2, POP3, RPOP, APOP, KPOP, all flavors of IMAP, ETRN, and ODMR. It can even support IPv6 and IPSEC.
Fetchmail retrieves mail from remote mail servers and forwards it via SMTP. It allows all your system MTA's filtering, forwarding, and aliasing facilities to work just as they would on normal mail.

Eventually, you want to retrieve emails from a mailbox located somewhere on the net and download it to your FREESCO box, that is what fetchmail is for…

Opening exim to the internet DOES NOT have any effect on mail which is going OUT of your freesco box. It is only needed if you want mail comming INTO your box from the internet. For example, mail addressed to you@yourdyndns. If you do not want this then don't open exim to the internet…

Now if you do want to be able to send mail from the internet to addresses you@yourdyndns then the following must be true:
1. Exim must realise that your internet address (dyndns/no-ip/…) is a local domain (the local_domains option in the config file). Restart exim to make any changes take effect with:

5. If the host name in question doesn't have the IP of your freesco box, then you need to set up an mx entry in the
dns which points to your freesco box (usually not something you need to worry about because your dyndns
address is usually your freesco box).

6.YOU SHOULD CHECK THAT YOU ARE NOT RUNNING AN OPEN RELAY. If you want to be able to send mail VIA freesco from the
internet then enable SMTP AUTH.

A couple of open relay checks can be found here and here – others can be found with google.
</box>

To make exim accessible from the internet :
edit /pkg/rc/rc_exim.

Comment out the firewall rule by adding a ”#” at the beginning of the line(s) that say :

Exim is using the syslog facility for its messages. Default exim tags these messages with type 'mail', so you can use /etc/syslog to send these messages to a seperate log file. The default /etc/syslog of FREESCO is rather simple and on my 027 box looks like:

To make this change permanent, you'll probably have to copy /etc/syslog.conf to /boot/etc for FREESCO 0.3.x and to /mnt/router/etc for FREESCO 0.2.7

Then reboot the box (or send a HUP signal to the syslogd and restart exim) you'll end up with a seperate log file /some/where/mail.log (where /some/where should be an existing directory on your FREESCO!) with only the exim messages in it.

More info about the syslog.conf syntax can f.i. be found here

Another method is to turn off logging within exim.

Simply add :

log_selector = -all

to the main part of the exim config file ( for instance just before the ACL section), this will make all of these annoying messages disappear.

To get exim to deliver e-mail send to non-existing users to a default mailbox,

(i.e. when someone sent an e-mail to a user that didn't exist in my aliases file
it would automatically be delivered to another existing user).
Open the /etc/exim.conf file
and look for this part in the configuration

This is the part of the config file, that makes exim check if the user is present.
If this is left as it is, mail send to users which do not exist in the aliases file
the mail is rejected with the message unrouteable address.

So in order to get a mail send to a non-existing user delivered to an existing user
all you need to do replace lsearch with lsearch* in this part of the config
so this is how it should look like…

Here you can see that /usr/sbin/sendmail points to the exim binary, ”/pkg/bin/exim”.
If you get something like “no such file or directory” instead, then you need to add a sendmail symlink to exim, do it like this :

ln -s /path/to/exim /usr/sbin/sendmail

where /path/to/exim should be replaced by the location of the exim binary on your system (If you use version 4.50 the path is /pkg/bin/exim, for previous versions (including exim 3.x) it's /usr/local/exim/bin/exim )
Php will need this in order to recognize the mail agent.
Next you will have to edit the php.ini file, located in /usr/local/lib, with :

cd /usr/local/lib
edit php.ini

Scroll down the file until you find these lines :

; For Unix only. You may supply arguments as well (default: 'sendmail -t -i').
;sendmail_path =

and uncomment the line that contains sendmail_path= by removing the “;” at the beginning, then add to the end “/usr/sbin/sendmail -t -i”, so it reads :

sendmail_path =/usr/sbin/sendmail -t -i

save the file (alt+x, y), and restart the web server with :

rc_httpd restart

Now you can test sending an email using a form script, it should work.

In order for updates to work, you need to have a licence key, to get it you will have to download a version of the antivir workstation complete package from antivir's web site.
Then save it on your local hard disk and extract the file, you can do it like this :

With this incoming emails will be analyzed and those which score a number over 5 in spamassassin's scale of recognition will have *SPAM* added in the subject header. Therefore it is easy to put a rule in your mail client (like thunderbird, outlook) to redirect spam to a different folder, separating it from regular emails.

Here is an extract from the log for spam (as seen in /var/log/spamd.log) :