On this page... (hide)
You can use Atmail to setup a complete Email Server for your company. Users can access accounts created in Atmail with external clients (Outlook, Eudora, etc.), or using the WebMail interface of Atmail. The Administrator can maintain user accounts and system settings via the WebAdmin interface.
In Server Mode, Atmail functions as a complete Email system. Users can optionally sign-up online and have full access to their email account via both the WebMail interface and using desktop POP3/IMAP clients. Using the WebAdmin interface, Atmail can be configured to run as a complete mail-server system for an ISP, company or as an office mail-server. The software can optionally be setup as a Freemail/Hotmail type service to offer WebMail services online.
User settings, Address Book, Scheduler tasks, profiles and user authentication information are stored in a MySQL database. Messages received by Atmail are stored on the local filesystem in Maildir format. POP3, IMAP, and WebMail retrieve the messages from the Maildir database.
Recommended:
Pentium Class 1GHz+ 512MB RAM 80GB HDD
Minimum:
Pentium II 500Mhz 128MB RAM 40GB HDD
* Linux ( RedHat Enterprise, Fedora, Mandrake, Suse, Debian, Slackware), * Unix ( Solaris, HP-UX, FreeBSD )
* MySQL-server * MySQL-devel * MySQL-client
* DB/DB-devel or GDBM/GDBM-devel - required by Courier-IMAP * GCC 3.4++/make * PHP-mbstring * PHP-xml
The above modules can be installed automatically using the installation script of Atmail Provided in the Server package:
* SMTP Server - Exim * POP3/IMAP Server * SpamAssassin * Optionally the Atmail/Clam Anti-Virus package.
The source-installation can be used to setup the complete Mailserver/WebMail mode of Atmail. This document will illustrate how to configure the Atmail software from source. If you only want to setup the WebMail client, please refer to the WebMail-source installation guide.
Before you install Atmail please make sure you meet the minimum Requirements.
It is recommended that you use the server-install.php script to configure your Atmail system.
The purpose of this script is to configure the Atmail application for the server, and to save the runtime settings to the main Configuration file (Config.php).
For non Linux systems ( FreeBSD, Solaris, etc ) before running the server-install.php script, the username 'atmail' must be created as a system account. Using the useradd/adduser utility depending on your OS. The UID of the new user must be UID 3000. For Linux systems the server-install.php script will automatically add the user-account to the system.
You run the installation script by running the following commands:
% tar xvfz atmailphp5server.tgz -C /usr/local/ % cd /usr/local/atmail/ % php server-install.php
Atmail must be installed under the default pathname of /usr/local/atmail/ - The atmail5.tgz archive has the directory structure pre-setup. Using the tar command extract the archive into the /usr/local directory.
If hard-disk space is an issue of the selected partition, the Atmail directory can be moved to another volume so long as the /usr/local/atmail directory is symbolically linked to the new directory.
Below is a walk through of the command-line installation script server-install.php:

The following few prompts will set up your MySQL Database for Atmail. You will need to supply a MySQL user that has permission to create databases.
Using Atmail you can scale the software solution by storing user email/account information on a separate machine from the webserver.
It is recommended to use Atmail and mySQL on the same machine for userbases under < 10,000 accounts.
If the MySQL server is setup on the same machine leave the 'Hostname' field blank. This will make Atmail communicate with the database server directly rather than opening a TCP/IP connection.

After this step you will have the option of creating the tables for the Atmail database, and test the MySQL configuration details are correct.
Then, continue:


Next you must specify the domain names for which you wish to host email accounts:
Continue to specify the Administrator email address and accept the configuration of Gzip compression and mod_deflate if they are detected as available.
In the next step of configuration, the installation utility will compile the SMTP server ( Exim ), POP3/IMAP server, Spamassassin and optionally the AV scanner from source.
Before installing these modules your system must have the gcc compiler installed with the relevant system libraries/headers ( gcc is installed as standard under common Unix platforms ).
The mySQL header and library files are also required to be installed before installation. These library files should be installed by default with mysql, otherwise you can obtain the header/library files from the Mysql.com site ( Download the RPM or binary for your selected system, otherwise build the mySQL server from source).



The next [optional] installation step is to run a diagnostic utility to verify local mail delivery for your Atmail system.
The following tests are performed: Account signup, message sending, message viewing via WebMail, and POP3 access. Note that the diagnostic utility can also be used via the graphical Webadmin to verify the installation.

Once the installation is complete, Atmail will start the services via the atmailserver init script and the software can be accessed via the address:
Here you can access the WebMail interface of Atmail and setup a new email-account at your selected domain. To begin using the WebAdmin interface of Atmail visit the URL:
http://youraddress.com/mail/webadmin/
After visiting the Webadmin you must enable a password for the access using the Webadmin → Security → Admin Password menu.

Atmail uses the SysV startup scheme, the atmailserver startup script will be located:
% /etc/init.d/atmailserver
You can start, restart and stop the services for Atmail, by using these commands after the script, for example:
% /etc/init.d/atmailserver start % /etc/init.d/atmailserver restart % /etc/init.d/atmailserver stop
Before installing the Server Mode Atmail RPM, you should first check the following:
Atmail can be installed using two different RPM methods. These include using the “yum” command under Fedora, or the regular RPM command manually. Both installation methods are outlined below, it is recommended to use the “yum” method for Fedora systems.
By using the “yum” feature of RedHat Fedora the Atmail software can be easily installed, with any missing dependencies automatically installed. This is the easiest method to install Atmail and requires the least effort.
To install follow the steps below in the exact order
Manually run the rpm command as follows:
root# rpm --import http://atmail.com/atmailphp-publickey.pub
This is required to trust installing the Atmail package using the yum command. Note once the Public-key is loaded no output is returned.
root# yum localinstall atmailserver.rpm Loading "installonlyn" plugin Setting up Local Package Process Examining atmailserver-demo.rpm: atmail-mailserver - 5.1demo-1.noarch Marking atmailserver-demo.rpm to be installed Setting up repositories Reading repository metadata in from local files Resolving Dependencies --> Populating transaction set with selected packages. Please wait. ---> Package atmail-mailserver.noarch 0:5.1demo-1 set to be updated --> Running transaction check Dependencies Resolved ============================= Package Arch Version Repository Size ============================= Installing: atmail-mailserver noarch 5.1demo-1 atmailserver-demo.rpm 101 M Transaction Summary ============================= Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 101 M Is this ok [y/N]: Downloading Packages: Installed: atmailwebmail.rpm
The output of the yum command will be similar as above. If any missing dependencies are detected ( e.g mysql, apache, php ) a prompt via yum will appear to install the missing packages.
/tmp# rpm -vi atmailserver.rpm
Please note the -vi flags, this is for 'verbose installation'. The installation will take between 1-5 minutes depending the speed of the hardware. Do not exit from the RPM command once run.
If you receive an error during the RPM installation, validate you have the correct Dependencies installed for Atmail.
You can also find the required dependencies from the Linux CD Installation discs
The Installation script is a PHP script that is run after a successful RPM install, in that : all the necessary files are in the correct places and necessary services have been installed.
The purpose of this script is to configure the Atmail application and save the runtime settings to the main Atmail Configuration file (Config.php). You run the installation script by running the following commands:
root# cd /usr/local/atmail/ root# php server-install.php server
After the welcome screen, the script goes through various sections regarding software and system dependencies. The first option for user input will be the Database Configuration
Atmail can be installed to use an SQL database backend to store user emails and account information. We recommend the use of mySQL for the Database backend for Atmail, which can be freely obtained at http://www.mysql.com/
Select the database name to store email/account information Select Database Name: [atmail]: Enter which user to connect to the database server. The users needs full permissions over the table to modify/read/write Enter Username: [root]: Enter the password for root to connect Enter Password for root: []:
Next, specify the hostname / IP address of the MySQL server.
Using Atmail you can scale the software solution by storing user email/account information on a separate machine from the webserver.
It is recommended to use Atmail and mySQL on the same machine for userbases under < 10,000 accounts.
If the MySQL server is setup on the same machine leave the 'Hostname' field blank. This will make Atmail communicate with the database server directly rather then opening a TCP/IP connection.
Enter Hostname: []:
After this step you will have the option of creating the tables for the Atmail database, and test the MySQL configuration details are correct. After the screens for enabling the Groupware module and specifying the Apache binary path, you will be given the option of entering the Domain name.
Please specify the domain names for which you wish to configure for Atmail. At least one domain name must be specified to complete the installation. Enter domain names for which you wish to host email accounts. Separate multiple domains by a comma.
Specify Domains: [uno.calacode.com]:
Here you can enter your domains. Ensure that you separate your domains with a comma for example:
mydomain.com, theirdomain.net, ourdomain.com, themdomain.org
The install script will then restart the mail servers to recognize the domain/s you entered in the above step.
Provide the following information to compile a libs/Atmail/Config.php file based on your server's unique configuration.
Enter admin email address: [admin@yourdomain.com]:
You will be first asked to add the Email Administrator account. The purpose of this is to allow any Atmail error or notification emails to be sent to this account.
The next step in configuration, will run an diagnostic utility to verify local mail delivery for your Atmail system.
The following tests are preformed: Account signup, message sending, message viewing via WebMail, POP3 access, AV and Spam Scanning. The diagnostic utility can also be used via the graphical Webadmin to verify the installation.
Running Email-Server tests. --- Creating account: OK --- Testing Mail Send: OK --- Accessing Mail: OK --- Viewing Mail messages: OK --- Checking remote POP3 for 427914305@yourdomain.com: OK --- Testing SMTP Virus scanner: OK --- Testing Anti-Spam scanner: OK --- 7 tests passed out of 7 ( 100 % )
/usr/local/atmail/ - The base installation directory, this is fixed for the Atmail
/usr/local/atmail/webmail/ - The Webmail/Webadmin application for Atymail.
/usr/local/atmail/av/ - The optional AV scanner for Atmail
/usr/local/atmail/spamassassin/ - The spamassassin installation directory, a custom build for Atmail.
/usr/local/atmail/mailserver/ - The SMTP, POP3 and IMAP services
The Atmail user is atmail this is the basic user required to navigate the ownership and permissions used for each part of the Atmail application, this user is created in the RPM install.
Once the installation is complete, Atmail will startup the Mail-server and the software can be accessed via the address:
http://youraddress.com/mail/
Here you can access the WebMail interface of Atmail and setup a new email-account at your selected domain. To begin using the WebAdmin interface of Atmail visit the URL:
http://youraddress.com/mail/webadmin/
After visiting the Webadmin you must enable a password for the access using the Webadmin → Security → Admin Password menu
Please note the following:

The Anti-Virus module scans incoming and outgoing messages for malicious Viruses, Worms and Trojans. The module protects user mailboxes by stopping virus emails reaching user accounts.
The Atmail AV module is based on the open-source ClamAV and the OpenAntiVirus project. The AV module is extended to scan email-messages and provide a Web-based interface to maintain the Anti-Virus scanner.
By default, Atmail installs the Anti-virus module during the installation process - which eases you of the trouble of manually installing the module. Should the Anti-virus software installation fail however, you can refer to this guide for directions on how to manually install it.
Go to your Atmail directory, then execute the buildav.php script. This script will install ClamAV with your Atmail installation, and build the binary in your /usr/local/atmail/av/ directory.
cd atmaildirectory ; php modules/buildav.php
Restart the Atmail startup file. This will start all the services vital to Atmail, including the Clamav daemon.
./etc/init.d/atmailserver restart
Update your ClamAV virus signature database by creating a cronjobs that checks daily for updates to the virus signature database from the ClamAV server. For this, you will need to create a file containing the following lines:
#!/bin/sh /usr/local/atmail/av/bin/freshclam --daemon-notify=/usr/local/atmail/av/etc/clamav.conf
Save the file in your cron directory; depending on your operating system, it could be either of the two below:
For Linux - /etc/cron.daily/clamupdate
For FreeBSD - /etc/periodic/daily/600.clamupdate
Give the file the proper permissions (755), then execute to download the latest virus signatures:
root# chmod 755 /etc/cron.daily/clamupdate root# /etc/cron.daily/clamupdate Checking for a new database - started at Tue Jan 28 08:17:36 2003 Current working dir is /usr/local/atmail/av/bin/clam Connected to calacode.com ....
The Atmail Anti-Virus Scanner can be configured via the WebAdmin. The following options are available when you access the Antivirus Settings utility, that can be found at your: WebAdmin > Filters > Antivirus Settings window:
Here is a screenshot of the Antivirus Filter Settings utility, that can be found at the WebAdmin interface:

To test if your AV-scanning facility works, just send a test email with the EICAR test signature. You can download the EICAR test signature from (http://calacode.com/eicar.txt), and attach it to an email; if your AV scanning facility is functional, the email should be blocked.
The pathname for your ClamAV binary is defined in the Exim configure file, that can be found at: /usr/local/atmail/mailserver/configure:
#<AVPATHNAME> av_scanner = clamd:/usr/local/atmail/av/clamdsocket #</AVPATHNAME>
Note that the file definition is surrounded by <CONFIG> tags - these tags allow Atmail to configure the file via the WebAdmin. It is highly recommended that the lines not be touched, else risk the unuseability of your Antivirus configuration utility.
The next group of lines are the settings for your AV installation.This is an ACL that checks the email content for viruses, and sends an error message to the SMTP layer if true. As above, the settings are surrounded by <CONFIG> tags.
#<AVSETUP> acl_check_content: deny message = Virus $malware_name detected. Mail delivery avoided. malware = * # finally accept all the rest accept #</AVSETUP>
When the acl_check_content ACL is called, the clamav daemon is called through a Unix socket. Exim serves as a client to the clamd background process, which then scans emails for viruses. This approach is much, much quicker than a re-exec of clamav eveytime on the commandline.
This section of the document will cover common errors that can occur during setup of Atmail with the AV module.
Check you have correctly enabled the AV scanner via the Atmail Web-admin. You will need to select the full pathname of the Anti-Virus scanner, and select the enable the Virus-Scanner in the pull-down menu. Consult the setup procedure for more information.
Before installing the Anti-Virus scanner you must create the user and group atmailav. The account must exist in the /etc/passwd and /etc/group file.
Depending on your OS use the adduser utility and groupadd.
The AV scanner downloads the new Anti-Virus signatures daily from http://calacode.com/database/viruses.db - If the Anti-Virus definitions are not automatically downloaded, check your servers connection to the Internet.
Browse related articles from our online Knowledge-base regarding the Antivirus guide
Exim is an SMTP (Simple Mail Transfer Protocol) Server for UNIX. Exim is our recommended and supported MTA for use with the Atmail application, as it includes additional functionality, including MySQL database lookups, which enhance the efficiency of Atmail and increase performance.
Your Exim installation references configuration details from the file /usr/local/atmail/mailserver/configure. Open the file using your text editor (ex. Vi, Emacs, Notepad), and at the top of the file, you will find the following lines:
#<SMTPLOAD> # Stop the SMTP if load > X smtp_load_reserve = 20 #</SMTPLOAD> #<SMTPQUEUELOAD> # Avoid mail-delivery, queue messages if load > X queue_only_load = 10 #</SMTPQUEUELOAD> #<SMTPDELIVERLOAD> # Don't run the queue if load > X deliver_queue_load_max = 8 #</SMTPDELIVERLOAD> smtp_banner = "Welcome to the Atmail SMTP Server ( Exim v4 ) "
Details about the settings are given on the commented sentences before each declaration.The <CONFIG> tags that follow each setting are the “markers” used by Atmail, so they can be configured via the WebAdmin easily. The values are changed when you edit your SMTP settings via the WebAdmin, so manual configuration of this part is not necessary.
It is also highly recommended that the <CONFIG> lines not be edited, else risk the unuseability of your WebAdmin SMTP configuration utility.
Below is a screenshot of the Atmail WebAdmin SMTP configuration utility. You can access this utility at your WebAdmin > Services > SMTP Settings window:
You can find the following lines in the “Atmail Custom Routers” section of your Exim configuration file:
# The MYSQL login details. hostname/database/username/password # <MYSQLCONFIG> hide mysql_servers = localhost/atmail/root/mypassword # </MYSQLCONFIG>
Your SMTP service references SQL to get details like relay permissions, domain configuration among many others. This section defines the details needed by Exim to connect to MySQL. The mysql_servers line requires the hostname of the mySQL server, database name, username and password (Note: the password must be set in mySQL, as Exim does not accept a blank password).
In the same way as your SMTP settings, the <MYSQLCONFIG> tags are “markers” used by Atmail, so this can be easily configured via the WebAdmin - no manual configuration is necessary.
When Exim delivers emails, they pass through a routine configured in the mailserver configuration file. This section defines how emails are handled, when they are sent or recieved by the server.
Before emails are recieved by the server, the sender-address is handled, or routed depending on how it is defined in your mailserver configuration file. The following is the default configuration for your Atmail installation, defined in the Routers section of your configuration file:
dnslookup: driver = dnslookup domains = ! +local_domains transport = remote_smtp ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 no_more
Exim checks if the domain is in the local domains by doing a DNS lookup on the domain name. If it is not in your local domains, the domain is treated as an outside address.
mysql_aliases:
driver = redirect
allow_fail
allow_defer
data = ${lookup mysql{ MYSQL_ALIASES }}
Exim checks if the address has an alias. This router calls the custom Atmail router called MYSQL_ALIASES, which checks if the user has an alias in the database, or is included in a catch-all account.
forward_director:
driver = redirect
data = ${lookup mysql {MYSQL_FORWARD}}
Exim then checks if the account has a forwarding rule. If this is true, the message is diverted to the external account. This router calls the Atmail custom SQL router called MYSQL_FORWARD, which searches for configured forward-addresses in the database.
spamcheck_router:
no_verify
domains = ${lookup mysql {MYSQL_CHECKSPAM}}
senders = ! ${lookup mysql {MYSQL_WHITELIST}}
condition = ${if and { {!def:h_X-Spam-Flag:} {!eq {spam-scanned}}
{!eq {local}} } {1}{0}}
driver = accept
transport = spamcheck
The address is then passed, and checked for any entries pertaining to it in the Whitelist. If the account is not in the whitelist, it is then checked for spam in the Transports section of the configuration file. This router uses the Atmail custom routers MYSQL_CHECKSPAM and MYSQL_WHITELIST, that check the domain names of the address in the Whitelist section of the database.
mysql_purgespam:
driver = manualroute
domains = ${lookup mysql {MYSQL_PURGESPAM}}
condition = "${if eq{$h_X-Spam-Flag:}{YES} {1}{0}}"
route_list = "* localhost byname"
transport = devnull
verify = false
If the email is marked as spam, Exim checks if the recipient has configured his/her account to automatically delete messages. If this is true, the email is automatically discarded.
mysql_spamfolder:
driver = manualroute
domains = ${lookup mysql {MYSQL_MOVESPAMFOLDER}}
condition = "${if eq{$h_X-Spam-Flag:}{YES} {1}{0}}"
route_list = "* localhost byname"
transport = mysql_delivery_spamfolder
verify = false
Optionally, if the user has configured his/her account to forward messages to a “Spam” folder, the emails are placed in the folder the user has selected. It is then handled by mysql_delivery_spamfolder in the Transports section.
autoreply_director:
driver = accept
senders = ! ^.*-request@.*: ! ^bounce-.*@.*: ! ^.*-bounce@.*: ! ^owner-.*@.*: ! ^postmaster@.*: ! ^webmaster@.*: ! ^listmaster@.*: ! ^mailer-daemon@.*: domains = ${lookup mysql {MYSQL_CHECKAUTOREPLY}}
condition = "${if !eq{$h_X-Spam-Flag:}{YES} {1}{0}}"
transport = mysql_autoreply
unseen
The recipient is then checked is it has autoreply configured. If this is true, the sender of the email is then checked if it is a bounced-message daemon, or an error list. Should this be true, the autoreply is not sent.
#<SMSNOTIFY>
sms_delivery:
driver = accept
domains = ${lookup mysql {MYSQL_SMSREPLY}}
condition = "${if !eq{$h_X-Spam-Flag:}{YES} {1}{0}}"
transport = mysql_sms
unseen
#</SMSNOTIFY>
The user is then sent an SMS message if an email is recieved. This router uses the MYSQL_SMSREPLY Atmail custom router, which checks if the account has SMS credits (SMSCredits.Credit > 0;)
mysql_user:
driver = accept
condition = ${lookup mysql {SELECT Account from UserSession WHERE Account='${local_part}@${domain}'} }
retry_use_local_part
transport=mysql_delivery
This is the final router, that sends the email to the account if it exists in the database.
Certain transports are called in the Routers section of your mailserver configuration file, used for certain instances, or if an email/account meets set parameters. The following is the default configuration for Exim, found in the Transports section of your mailserver configuration file:
devnull: driver = appendfile file = /dev/null
This transport is called when the user has purge-spam enabled on his/her account. The email is sent to /dev/null, or deleted permanently.
mysql_delivery_spamfolder:
driver = appendfile
maildir_format
mode = 0660
mode_fail_narrower = false
envelope_to_add = true
return_path_add = true
quota = ${lookup mysql{SELECT (UserQuota * 1024 * 1024) FROM Users WHERE
Account='${local_part}@${domain}'}{7M}}
directory = ${lookup mysql{SELECT concat(MailDir, "/.Spam/")
from Users where Account='${local_part}@${domain}'}}
If the account has Spam-forwarding configured on his/her account, this transport is called. The transport queries the database for the folder the user specified to send spam to, then sends the email to the spam folder.
mysql_delivery:
driver = appendfile
maildir_format
mode = 0660
mode_fail_narrower = false
envelope_to_add = true
return_path_add = true
quota = ${lookup mysql{SELECT (UserQuota * 1024 * 1024) FROM Users WHERE
Account='${local_part}@${domain}'}{7M}}
directory = ${lookup mysql{SELECT MailDir from Users where Account='${local_part}@${domain}'}}
This transport handles mail delivery. User-quoata is first checked, then the directory of the user is queried from the database, then saved in MailDir format.
spamcheck:
driver = pipe
command = /usr/local/atmail/mailserver/bin/exim -oMr spam-scanned -bS
use_bsmtp = true
transport_filter = /usr/local/atmail/spamassassin/bin/spamc -u '${local_part}@${domain}'
home_directory = "/tmp"
current_directory = "/tmp"
log_output = true
return_fail_output = true
return_path_add = false
message_prefix =
message_suffix =
Transport called if the account is not on the Whitelist. Exim then checks for spam probability with the SpamAssassin binary, and displays logs when necessary.
Atmail uses custom SQL routers to query your MySQL database for account data, relay configuration, and domain name information. They can be found in the Atmail Custom Routers section of your mailserver configuration file. Here is a list of the default SQL routers for your mailserver:
MYSQL_MOVESPAMFOLDER = select DISTINCT domain from SpamSettings where username='${quote_mysql:$local_part}@${quote_mysql:$domain}' and preference='spam_treatment' and value='trash'
MYSQL_PURGESPAM = select DISTINCT domain from SpamSettings where username='${quote_mysql:$local_part}@${quote_mysql:$domain}' and preference='spam_treatment' and value='delete'
MYSQL_FORWARD = select Forward from Users where Account='${quote_mysql:$local_part}@${quote_mysql:$domain}' and Forward like '%@%' and Forward != '${quote_mysql:$local_part}@${quote_mysql:$domain}'
MYSQL_AUTOREPLY = select AutoReply from Users where Account='${quote_mysql:$local_part}@${quote_mysql:$domain}' and AutoReply != and Account !='${quote_mysql:$sender_address}'
MYSQL_CHECKAUTOREPLY = select DISTINCT '$domain' from Users where Account like '%@${quote_mysql:$domain}' and Account='${quote_mysql:$local_part}@${quote_mysql:$domain}' and AutoReply != and Account !='${quote_mysql:$sender_address}'
MYSQL_DOMAINS = select Hostname from Domains where Hostname='${quote_mysql:$domain}'
MYSQL_USEREXISTS = select DISTINCT '$domain' from Users where Account ='${quote_mysql:$local_part}@${quote_mysql:$domain}'
MYSQL_CHECKSPAM = SELECT DISTINCT '$domain' FROM UserSession WHERE Account ='${quote_mysql:$local_part}@${quote_mysql:$domain}'
MYSQL_WHITELIST = SELECT DISTINCT value from SpamSettings where username='${quote_mysql:$local_part}@${quote_mysql:$domain}' and preference=“whitelist_from” and ( value='${quote_mysql:$sender_address}' OR value='*@${quote_mysql:$sender_address_domain}' )
MYSQL_ALIASES = select AliasTo from MailAliases where AliasName='$local_part@$domain' or AliasName='$domain'
MYSQL_RELAY = SELECT IPaddress from MailRelay where IPaddress=“${sender_host_address}“
MYSQL_SMSREPLY = SELECT DISTINCT '$domain' from SMSfilter,SMSCredits where SMSfilter.Account='${quote_mysql:$local_part}@${quote_mysql:$domain}' and SMSCredits.Account='${quote_mysql:$local_part}@${quote_mysql:$domain}' and SMSCredits.Credit > 0;
Browse related articles from our online Knowledge-base regarding the Atmail Exim configuration guide
Atmail POP3 and IMAP Services allows your ( server-mode ) Atmail users to access their email with an IMAP Client such as Outlook, or a POP3 client such as Eudora. This provides users with two methods to access their email messages, the Webmail via their browser, and directly using their third party mail clients.
/etc/init.d/atmailserver start
This script starts all Atmail services, including POP3 and IMAP.
/usr/local/atmail/mailserver/
This is the path for POP3 and IMAP, the binaries for these services are located:
/usr/local/atmail/mailserver/bin/pop3d /usr/local/atmail/mailserver/bin/imapd
The configuration files are located:
/usr/local/atmail/mailserver/etc/pop3d /usr/local/atmail/mailserver/etc/imapd
Settings in these files are automatically edited by the Webadmin. While it is possible to manually edit this files directly, we strongly recommend using the Webamin Interface to change any settings.
Users access the Atmail Server remotely using a third party email client such as Outlook. Depending on the User's port access ( 110 for POP3 and 143 for IMAP ), the POP3 or IMAP Service will being authentication for the user and query the Atmail database for the User's Session, Mail Directory ( MailDir and Group Permissions ( to check for permissions for that user to access either the POP3 or the IMAP Services. The MailDir for a user contains the first character of their username, the second character of their username, their username and domain, these are located at /usr/local/atmail/users.
For example:
/usr/local/atmail/users/t/e/test0761@au.calacode.com /usr/local/atmail/users/j/i/jim@au.calacode.com
Once authenticated the POP3 or IMAP Service will read this directory and provide messages to the User depending on their Email Client Settings. The MailDir is created automatically when an Account on the system is created.
Here we go into more detail on the authentication that takes place between the POP3 or IMAP service and the MySQL database:
SELECT distinct UserSession.Account, , UserSession.Password, '3000', '3000', Users.MailDir, Users.MailDir, , CONCAT("Users.FirstName", ',', 'Users.LastName'), CONCAT("allowimap=",Groups.IMAPSupport,", allowpop3=", Groups.POP3Support,",allowwebmail=",'1', ",sharedgroup=",'1') FROM UserSession, Users, Groups WHERE UserSession.Account = CONCAT('$(local_part)', '@', '$(domain)') AND Users.Account = UserSession.Account and (Users.Ugroup=Groups.GroupName or Groups.GroupName='Default' and ( Users.Ugroup='' or Users.Ugroup is null) and Users.Account=CONCAT('$(local_part)', '@', '$(domain)'))
An Example of the result will return the user account details and location of the maildir directory for the account. The POP3/IMAP server will then match the password supplied to the client from the SQL database.
For the Permissions ( allowing / restricting POP3 or IMAP Access for the User ), the Default Group can be specified, or the User moved into another Group providing or restricting POP3 or IMAP Access. Please see the Webadmin → Users → Group Manager for more information.
The User ID 3000 is created automatically by the install script which is the UID of the atmail username. The atmail user must have full read/write permissions over the /usr/local/atmail/users directory for mail-delivery and pop3/imap access to function.
/usr/local/atmail/mailserver/etc/authmysqlrc
This file contains the settings for the authentication between the POP3/IMAP server and mySQL . Each POP3/IMAP connection the mail-server will query the database if the selected user exists.
The 'Users' table in the MySQL Database tells the POP3 or IMAP Service where the User's directory is ( MailDir field ), it does this by authenticating via the authdaemon, which accesses the MySQL database in turn.
The Authdaemon provides the following access to the MySQL database.
MYSQL_SERVER localhost MYSQL_USERNAME root MYSQL_PASSWORD
These details are provided by the install script and by the Webadmin Interface if you change the Database Access details.
Here you can specify the configuration settings for the POP3 Service, this includes enabling the POP3 service, setting the maximum connections and the maximum connections per IP Address as well as optionally binding the POP3 Server to an IP Address on the server.

Please Note: If the POP3 Service is currently running, you will need to restart the atmailserver on the console:
# /etc/init.d/atmailserver restart
Here you can specify the configuration settings for the IMAP Service, this includes enabling the IMAP Service, setting maximum limits on connections and connnections per IP Address and optionally setting IMAP Timeout and Purge Trash/Spam Folder.

Please Note: If the IMAP Service is currently running, you will need to restart the atmailserver on the console:
# /etc/init.d/atmailserver restart
Here is where you can optionally add IP Addresses ( permanent and temporary ), that will allow Users accessing via that IP Address to Relay Mail through the SMTP Server.
Browse related articles from our online Knowledge-base regarding the IMAP/POP3 guide:
* http://kb.atmail.com/view_article.php?num=318 - How to enable SSL for POP3 & IMAP server-mode * http://kb.atmail.com/view_article.php?num=319 - How to turn on debugging mode for IMAP/POP3 * http://kb.atmail.com/view_article.php?num=558 - Increasing POP3/IMAP relay timeout * http://kb.atmail.com/view_article.php?num=389 - Building Courier - POP3 / IMAP on Gentoo