Hedwig Mail server
Hedwig Mail Server - The Open Source IMAP/SMTP/POP3 Server for Java
Hedwig is an open source IMAP, SMTP, POP3 server written in Java, designed with ease of installation and configuration in mind. Hedwig enables storage of mail message headers in a relational database and mail messages in a file system. Currently MySQL and Oracle can be used as storage backend.
Features
- 100% pure Java capable of running on Java 1.6 onwards
- Based on Java NIO framework (Netty)
- A normal MTA (Currently Postfix) can be used for accepting messages. The MTA hands the messages using a pipe interface. LMTP (Local Mail Transport Protocol) support is in progress.
- Multiple virtual domains
- Built in SSL encryption
- Pluggable Authentication Module(PAM) using JAAS
- Automated Message File Compression
- Authenticated SMTP (SMTP AUTH)
- Message filtering using Sieve scripts
- Web based administration console
- Webmail client
Pre-Installation Requirements
- Java Developer Kit (JDK) 1.6.x or greater for compiling/building
- The JAVA_HOME environment variable must be set to the directory where the JDK is installed, e.g., c:\Program Files\java\jdk.1.8.0_77.
- Maven 1.0.2 or greater (required when installing source)
Checking out the sources with Subversion
You need a Subversion client to access the Hedwig source repository. Once you have the Subversion client installed you can checkout the main Hedwig source tree with the following command or its equivalent in the client you are using:
svn co svn://svn.code.sf.net/p/hwmail/code/trunk hwmail
The above checkout will create a subdirectory named hwmail that contains the latest Hedwig sources.
Source Installation
This procedure explains how to install from the source distribution.
- Extract source from the ZIP file into a directory of your choice. For a source distribution, the file name will be similar to: hedwig-x.x-src.zip.
- Build Hedwig using Maven and Java 1.6. The method of building Hedwig is the following:
mvn clean package
If the above build fails on some tests, type the following:
mvn clean package -Dmaven.test.skip=true
- If you prefer to use an IDE, then you can auto-generate the IDE's project file using maven plugins:
mvn eclipse:eclipse
- Proceed to the Binary_Installation with binary distribution file in assembly/target directory.
Binary Installation
- Extract the binary distribution file into a directory of your own. For a windows binary distribution, the filename will be similar to: hedwig-x.x.zip. For a unix binary distribution, the filename will be similar to: hedwig-x.x.tar.gz.
- Proceed to the Configuration chapter of this document.
- Proceed to the Running the server chapter of this document.
MySQL Setup
Before starting the Hedwig IMAP server, you need to create the hedwig database in MySQL. There are two files in the sql/mysql directory: hedwig-schema.sql and hedwig.mwb.
The hedwig-schema.sql file contains all the CREATE statements required to create the structure of the hedwig database including tables and triggers.
The hedwig.mwb file is a MySQL Workbench data model that you can open within MySQL Workbench.
To install the hedwig database, follow these steps:
- Connect to the MySQL server using the mysql command-line client with the following command:
shell> mysql -u root -p
Enter your password when prompted. A non-root account can be used as long as the account has privileges to create new databases.
- Execute the hedwig-schema.sql script to create the database structure by using the following command:
mysql> SOURCE D:/hedwig/sql/mysql/hedwig-schema.sql;
Replace D:/hedwig/sql/mysql/hedwig-schema.sql with the path to the hedwig-schema.sql file on your system.
- Confirm that the hedwig database is installed correctly. Execute the following statements. You should see output similiar to that shown here.
mysql> USE hedwig; Database changed mysql> SHOW TABLES;
+------------------+ | Tables_in_hedwig | +------------------+ | hw_acl | | hw_alias | | hw_headername | | hw_headervalue | | hw_keyword | | hw_mailbox | | hw_message | | hw_physmessage | | hw_subscription | | hw_user | +------------------+ 10 rows in set (0.00 sec)
Managing users
You can manage users directly using SQL queries. And you can also manage users using Web console. See the Web Console for more information about Web console.
Managing aliases
You can manage aliases directly using SQL queries. And you can also manage aliases using Web console. See the Web Console for more information about Web console.
The alias table provides a system-wide mechanism to redirect mail for local recipients.
DNS configuration
Before configuring the server, make sure you configure your DNS server correctly. For SMTP to work, you must define MX records for your domain. MX stands for Mail eXchanger. Simply put the MX records tell other email servers what server in your domain is responsible for handling mails.
Nslookup is a command line program that basically queries DNS-servers for information. You can do all kind of DNS lookups using nslookup. The text below shows how to do MX lookups. Start the command prompt and check if the response include an MX record.
C:> nslookup -type=mx yourdomainname.com Server: your-isp-dns-host Address: your-isp-dns-address yourdomainname.com MX preference = 10, mail exchanger = mail.yourdomainname.com (the line above is your MX exchanger) mail.yourdomainname.com internet address = your-mail-server-ip
Configuring the server
Hedwig has minimal configuration parameters that are controlled via the default.properties file. You can find this file at conf directory. Before starting the server, you need to configure some parameters to your environment. Enter the JDBC URL for the jdbc.url property, and adjust username/password for the database.
jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://[host]:[port]/hedwig jdbc.user=[username] jdbc.password=[password] jdbc.maxActive=[number] jdbc.maxIdle=[number]
- jdbc.driver
The fully qualified Java class name of the JDBC driver to be used.
- jdbc.url
The connection URL to be passed to our JDBC driver to establish a connection.
- jdbc.user
The connection username to be passed to our JDBC driver to establish a connection.
- jdbc.password
The connection password to be passed to our JDBC driver to establish a connection.
- jdbc.maxActive (default: 8)
The maximum number of active connections that can be allocated from connection pool at the same time, or zero for no limit.
- jdbc.maxIdle (default: 8)
The maximum number of active connections that can remain idle in the pool, without extra ones being released, or zero for no limit.
In minimal configuartion, all you need to configure is the jdbc related parameters if the host name for your server is properly set.
The default.properties configuration file specifies minimal parameters that control the operation of the server. Most parameters have default values, and need not to be specified.
Default values are shown after the parameter name in parentheses.
- data_directory (default: $home/data)
The directory where Hedwig data files are stored. This directory must be owned by the hedwig account, and must not be shared with non-Hedwig software.
- temp_directory (default: $home/temp)
The directory where Hedwig temporary files are stored.
- queue_directory (default: $home/spool)
The location of Hedwig top-level queue directory. This is the root directory of Hedwig MTA daemon is monitoring.
- tls_keystore (default: empty)
The location of keystore file. This file must be in JKS format. You can create this file using keytool command-line utility included in the JDK. You MUST specify this parameter if you want to use SSL/TLS for IMAP or SMTP server. See the Using SSL/TLS for more information about how to configure SSL/TLS.
- tls_keypass (default: empty)
Password for recovering keys in the keystore. You need not specify this parameter if the tls_keystore parameter is not specified.
- tls_storepass (default: empty)
Password used to check the itegrity of keystore. You need not specify this parameter if the tls_keystore parameter is not specified.
- auth_scheme (default: empty)
Name of the JAAS login module. See the JAAS LoginModule for more information about JAAS login module.
Configuring the IMAP server
Followings are description of all IMAP configuration parameters.
- compress_after (default: empty)
Message files are automatically compressed after the configured time. The actual compression is done in a nighty cronjob, which you must set up:
Time units: y(years), m(months), d(days)
Example: compress_after=3m
- expunge_after (default: empty)
Mails are expunged from mailboxes after being there the configurable time. The actual expunging is done in a nightly cronjob, which you must set up:
Example: expunge_after=INBOX 3m Trash 2m
- stop_cron_after (default: 2h)
Stop disk cleanup cron (which is responsible for compression of message file and expunging mails) after the configured time from it started.
Time units: h(hours), m(minutes)
Example: stop_cron_after=3h
- default_quota (default: 0)
The default quota for uers in mega bytes. Specify 0 when user has no limit in quota.
- imap_timeout (default: 1800)
The IMAP socket I/O timeout value in seconds, or zero (timeout infinity).
- imap_thread_count (default: 2 * the number of available processors in the machine)
The maximun number of IMAP worker threads.
- imap_trace_protocol (default: false)
The IMAP protocol trace mode. If true protocol trace will be printed to the output specified by the imap_protocol_log parameter.
- imap_protocol_log (default: empty)
The location of file used for debugging output for IMAP protocol. If empty, the standard output will be used.
Configuring the SMTP server
If you decided to use legacy MTA like Postfix, you dont need to read this section. Instead see Configuring_MTA for more information about the legacy MTA configuration.
SMTP configuration parameters are also controlled via the default.properties file. Before starting the server, you need to configure some parameters to your environment.
Followings are description of all SMTP configuration parameters.
- max_retry_count (default: 3)
The maximal number of times that a spooled message attempts to be re-sent. If a temporary exception has been caught during transmission, the infrastucture automatically retransmits the message. If a permanent exception is caught, a failure message is sent to the original message sender or postmaster. The retransmission algorithm quadruples the delay with every attempt, which result in approximately 42 minutes passing between the first transmission attempt and the last transmission attempt.
- message_size_limit (default: 10240000)
The maximal size in bytes of a message, including envelope information. Specify 0 when message size has no limit.
- mydomain
The internet domain name of this mail system. The default is to use $myhostname minus the first component.
Example: mydomain=example.com
- myhostname
The internet hostname of this mail system. The default is to use the fully-qualified domain name from gethostname().
Example: myhostname=host.example.com
- mynetworks (default: see hwadmin mynetworks output)
The list of trusted SMTP clients that have privileges to relay mail through Hedwig. Specify a list of network address, network/netmask or network/netmask bits patterns, separated by commas and/or whitespace.
Note 1: If you set the mynetworks to 0.0.0.0/0, the Hedwig acts as an open relay server.
Example: mynetworks=127.0.0.0/8 168.100.189.0/24 168.100.170.0/255.255.255.0
- postmaster (default: postmaster@mydomain)
The sender address of delivery status notification message.
Example: postmaster=postmaster@example.com
- smtp_helo_name (default: $myhostname)
The host name to send in the SMTP EHLO or HELO command. The default value is the machine hostname.
- smtp_gateway
SMTP server to be used as a gateway for this server. If this value is set, then all messages with remote recipients will be delivered to the gateway server. The port may be specified in the format host:port.
- smtp_gateway_username
The username to be passed to the SMTP gateway to establish a connection.
- smtp_gateway_password
The password to be passed to the SMTP gateway to establish a connection.
- smtp_recipient_limit (default: 0)
The maximum number of recipients that the Hedwig SMTP server accepts per message delivery request. Specify 0 when recipients count has no limit.
- smtp_sasl_auth_enable (default: no)
Enable SASL authentication in the Hedwig SMTP server. By default, the Hedwig SMTP server does not use authentication.
- smtp_connect_timeout (default: 5000)
The Hedwig SMTP client socket connection timeout value in milliseconds. When no connection can be made within the deadline, the Hedwig SMTP client tries the next SMTP server associated with target MX record.
- smtp_timeout (default: 5000)
The Hedwig SMTP client socket I/O timeout value in milliseconds.
- smtp_trace_protocol (default: false)
The SMTP protocol trace mode. If true protocol trace will be printed to the console.
- smtp_protocol_log (default: empty)
The location of file used for debugging output for SMTP protocol. If empty, the standard output will be used.
- smtpd_client_restrictions (default: empty)
Optional restrictions that the Hedwig SMTP server applies in the context of a client request.
The default is to allow all connection requests.
The following restrictions are specific to client hostname or client network address information.
- permit_mynetworks
Permit the request when the client IP address matches any network or network address listed in mynetworks.
- reject_rbl_client rbl_domains
List of servers that provides real-time black list (RBL) and domain name server black lists (DNSBL). Connections are blocked when the reversed client network address is listed with the A record under these domains.
Specify a list of rbl domains, separated by whitespace.
Note 1: If you're running a high-traffic mail server, you'd better setup a local DNS server to catch DNS queries, because free RBL service like zen.spamhaus.org may improperly reply if your server exceed the DNS query limit.
In addition, you can use the following generic restrictions.
- reject
Reject the request. This restriction is useful at the end of a restriction list, to make the default policy explicit.
Example: smtpd_client_restrictions=permit_mynetworks, reject_rbl_client zen.spamhaus.org spamlist.or.kr, reject
- permit_mynetworks
- smtpd_error_sleep_time (default: 1)
SMTP server response delay in second after a client has made more than smtpd_soft_error_limit errors, and fewer than smtpd_hard_error_limit errors, without delivering mail.
- smtpd_hard_error_limit (default: 20)
The maximum number of errors a SMTP client is allowed to make without delivering mail. The Hedwig SMTP server disconnects when the limit is exceeded.
- smtpd_recipient_restrictions (default: empty)
Optional restrictions that the Hedwig SMTP server applies in the context of a client RCPT TO command.
The default is to permit everything.
- check_recipient_access table
Search the specified access table for the resolved RCPT TO address, domain, or localpart@, and execute the corresponding action. If access table is not specified, conf/recipient_access file is used as a default table.
- reject_unlisted_recipient
Reject the request when the RCPT TO address does not exist in the local user database.
- check_recipient_access table
- smtpd_relay_restrictions (default: permit_mynetworks, permit_sasl_authenticated, reject)
Access retrictions for mail relay control that the Hedwig SMTP server applies in the context of the RCPT To command. Specify a list of restrictions, separated by commas.
IMPORTANT: If you do not specify this restrictions Hedwig will acts as an open relay server.
- permit_sasl_authenticated
Permit the request when the client is successfully authenticated via the RFC 4954 (AUTH) protocol.
- permit_sasl_authenticated
- smtpd_sender_restrictions (default: empty)
Optional restrictions that the Hedwig SMTP server applies in the context of a client MAIL FROM command.
The default is to permit everything.
- check_sender_access table
Search the specified access table for the MAIL FROM address, domain, or localpart@, and execute the corresponding action. If access table is not specified, conf/sender_access file is used as a default table.
- check_sender_access table
- smtpd_soft_error_limit (default: 10)
The number of errors a SMTP client is allowed to make without delivering mail before the Hedwig SMTP server slows down all its responses.
- smtpd_timeout (default: 300000)
The SMTP server socket I/O timeout value in milliseconds, or zero (timeout infinity).
Configuring MTA
If you decided to use Hedwig's own MTA, you don't need to read this section. Instead see the Configuring_the_SMTP_server for more information about the MTA configuration.
LDA with Postfix
Hedwig LDA is easy to configure with Postfix virtual domains support. Hedwig supports two delivery methods PIPE and LMTP.
Using piped delivery
Add hedwig-pipe service in /etc/postfix/master.cf:
hedwig-pipe unix - n n - - pipe flags=DRhu user=hedwig/hedwig argv=/home/hedwig/bin/deliver.sh ${sender} ${recipient}
Replace hedwig above with your virtual mail user account.
Then set virtual_transport to hedwig-pipe in /etc/postfix/main.cf.
default_destination_recipient_limit = 50 virtual_mailbox_domains = your.domain.here virtual_transport = hedwig-pipe
And remember to run
postfix reload
Using LMTP delivery
LMTP will be supported in near future.
Add hedwig-lmtp service in /etc/postfix/master.cf:
hedwig-lmtp unix - - n - - lmtp
Then set virtual_transport to hedwig-lmtp in /etc/postfix/main.cf.
virtual_transport = hedwig-lmtp:<host>:<port>
Comment the bean definitions with followings IDs in the applicationContext.xml. (smtp.server, smtps.server, smtp.taskExecutor)
Configuring the client
Configuring MS Outlook 2007
Use the following method to configure Outlook as an IMAP4 client.
- Start Outlook.
- On the Tools menu, click Account Settings.
- Click New.
- Click Microsoft Exchange, POP3, IMAP, or HTTP, and then click Next.
- In the Auto Account Setup dialog box, click to select the Manually configure server settings or additional server types check box, and then click Next.
- Click Internet E-Mail, and then click Next.
- In the Server Information section, select IMAP for Account Type.
- In the Your Name box, enter your name exactly as you want it to appear to recipients.
- In the E-mail Address box, type your e-mail address.
- In the User Name box, type your your account name. If the server supports multiple domains, then type your e-mail address not your account name.
- In the Password box, type your password.
- In the Incoming mail server box, type the name of your IMAP4 server.
- In the Outgoing mail server (SMTP) box, type the name of your SMTP server.
- Click Next after you have completed entering this configuration information, and then click Finish.
Configuring Mozilla Thunderbird 3.1
Use the following method to configure Thunderbird as an IMAP4 client.
- Start Thunderbird
- On the Tools menu, click Account Settings.
- Click the Account Actions button and select Add Mail Account.
- In the Your name box, enter your name exactly as you want it to appear to recipients.
- In the Email address box, type your e-mail address.
- In the Password box, type your password.
- Click Continue. Thunderbird will try to determine your account settings based on the domain portion of your email address (that is, the portion after the "@" symbol). Press the Stop button to abort the lookup, then edit the server names, port and IMAP, and then press Manual Configuration to manually set up the the account. Note that it's important that you set server names, port and IMAP before clicking Manual Config.
- In the Account Settings dialog, in the left pane, select Server Settings option under your new account.
- In the right pane, make sure the User Name box contains your account name. If the server supports multiple domains, then type your e-mail address not your account name.
Configuration File Example
The following is a very simple example of a production default.properties file. The line numbers shown are provided for reference only and are not included in the actual file.
1. # Database connection information 2. 3. # MySQL Database connection 4. jdbc.driver=com.mysql.jdbc.Driver 5. jdbc.url=jdbc:mysql://localhost/hedwig 6. jdbc.user=hedwig 7. jdbc.password=s3cret 8. jdbc.maxActive=120 9. jdbc.maxIdle=30 10. 11. # Network information 12. mydomain=hedwig.org 13. myhostname=mail.hedwig.org
Lines 1 and 3 are comments. Line 4 through 9 are for database connection information.
Line 11 is a comment. Line 12 specifies the internet domain name of the mail system. Line 13 specifies the internet hostname of the mail system.
Starting
Run the server with the bin/run.sh command with start parameter on Unix/Linux or bin/run.bat on Windows system:
localhost:/home/hedwig/bin# ./run.sh start -- or -- D:\hedwig\bin> run.bat
The server should be now running and ready for imcoming IMAP4 connections.
Stopping
Run the server with the bin/run.sh command with stop parameter on Unix/Linux system. On Windows system close the running window:
localhost:/home/hedwig/bin# ./run.sh stop
Checking that server is running
Check that Hedwig IMAP server is listening for connections:
# telnet localhost 143 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. * OK Hedwig ready.
If you get "connection refused", check the log files for error messages.
Check that Hedwig SMTP server is listening for connections:
# telnet localhost 25 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 example.com Service ready
If you get "connection refused", check the log files for error messages.
Check that Hedwig POP3 server is listening for connections:
# telnet localhost 110 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. +OK POP3 server ready
If you get "connection refused", check the log files for error messages.
Entity Relationship Model
Tables in Hedwig
This is a more detailed description of the tables in hedwig in alphabetic order.
hw_acl
Defines Access Control List for shared mailboxes. IMAP4 ACL extension is defined in RFC 2086.
Attribute | Data Type | Description |
---|---|---|
userid | BIGINT | First primary key and foreign key referencing hw_user.userid. |
mailboxid | BIGINT | Second primary key and foreign key referencing hw_mailbox.mailboxid. |
lookup_flag | CHAR | Mailbox is visible to LIST/LSUB commands, SUBSCRIBE mailbox. |
read_flag | CHAR | SELECT the mailbox, perform STATUS |
seen_flag | CHAR | Set or clear SEEN flag via STORE, also set them during APPEND/COPY. |
write_flag | CHAR | Set or clear other than SEEN and DELETED via STORE, also set them during APPEND/COPY. |
insert_flag | CHAR | Perform APPEND, COPY into mailbox. |
post_flag | CHAR | Send mail to submission address for mailbox. |
create_flag | CHAR | CREATE new sub-mailboxes in any implementation-defined hierarchy, parent mailbox for the new mailbox name in RENAME. |
delete_flag | CHAR | DELETE mailbox, old mailbox name in RENAME. |
deletemsg_flag | CHAR | Set or clear other than DELETED flag via STORE, also set them during APPEND/COPY. |
expunge_flag | CHAR | Perform EXPUNGE and expunge as a part of CLOSE. |
admin_flag | CHAR | Perform SETACL/DELETEACL/GETACL/LISTRIGHTS. |
hw_alias
Defines the mail routing address for specific mail address.
Attribute | Data Type | Description |
---|---|---|
aliasid | BIGINT | Primary key. |
alias | VARCHAR(100) | Destination by MDA. |
deliver_to | VARCHAR(100) | Mail routing address. |
hw_headername
Message header names referenced by headervalue table.
Attribute | Data Type | Description |
---|---|---|
headernameid | BIGINT | Primary key. |
headername | VARCHAR(100) | Header name. |
hw_headervalue
Message header values stored in each raw e-mail.
Attribute | Data Type | Description |
---|---|---|
headervalueid | BIGINT | Primary key. |
physmessageid | BIGINT | Foreign key referencing hw_physmessage.physmessageid. |
headernameid | BIGINT | Foreign key referencing hw_headername.headernameid. |
headervalue | TEXT | Header value. |
hw_keyword
User flags for each messages are stored in this table.
Attribute | Data Type | Description |
---|---|---|
messageid | BIGINT | Primary key and foreign key referencing hw_message.messageid. |
keyword | VARCHAR(255) | Keyword of the message. |
hw_mailbox
Mailbox information is stored in this table.
Attribute | Data Type | Description |
---|---|---|
mailboxid | BIGINT | Primary key. |
ownerid | BIGINT | Foreign key referencing hw_user.userid. |
name | VARCHAR(255) | Name of mailbox including the hierarchy information. |
noinferiors_flag | CHAR | No child levels under this mailbox possible. |
noselect_flag | CHAR | Not possible to use this mailbox as selectable mailbox. |
readonly_flag | CHAR | READ-ONLY or READ-WRITE. |
nextuid | BIGINT | The next unique indentifier for the message which will be stored in this mailbox. |
uidvalidity | BIGINT | The unique indentifier validity value for this mailbox. |
hw_message
Message information for each mailboxes. IMAP system flags for each messages as defined in RFC 3501.
Attribute | Data Type | Description |
---|---|---|
messageid | BIGINT | Primary key. |
mailboxid | BIGINT | Foreign key referencing hw_mailbox.mailboxid. |
physmessageid | BIGINT | Foreign key referencing hw_physmessage.physmessageid. |
seen_flag | CHAR | Message has been read. |
answered_flag | CHAR | Message has been answered. |
deleted_flag | CHAR | Message is deleted for removal by later EXPUNGE. |
flagged_flag | CHAR | Message is flagged for urgent or special attention. |
recent_flag | CHAR | Message recently arrived in this mailbox. |
draft_flag | CHAR | Message has not completed composition. |
hw_physmessage
Mapping table for message and raw e-mail message stored in file system.
Attribute | Data Type | Description |
---|---|---|
physmessageid | BIGINT | Primary key. |
rfcsize | BIGINT | Raw mail size. |
internaldate | BIGINT | Internal Date Message Attribute. |
subject | CHAR | Envelope structure's SUBJECT field string. |
sentdate | CHAR | RFC-2822 Date: header value. |
fromaddr | CHAR | Envelope structure's FROM field. |
hw_subscription
Subscribed mailboxes of a user returned by LSUB command.
Attribute | Data Type | Description |
---|---|---|
userid | BIGINT | First part of unique key and foreign key referencing hw_user.userid. |
mailboxid | BIGINT | Second part of unique key and foreign key referencing hw_mailbox.mailboxid. |
name | VARCHAR(255) | Name of the mailbox subscribed. |
Directory Structure
Installing the Hedwig distribution creates a hedwig-version directory that contains server start scripts, JARs, server configuration sets, SQL scripts and working and data directories.
Directory | Description |
---|---|
bin | Start and delivery scripts are located in the bin directory. |
conf | The conf directory contains the applicationContext.xml and default.properties file for server configuration. |
data | The data directory contains all the message files delivered to this server. Message files are stored in sub directories that are dynamically created according to the date of transmission. These sub directories look like this: data/mail/YYYY/MM/DD/XX where XX is modular for the physical message ID of the message file. |
lib | The lib directory contains all Java libraries used by Hedwig. |
spool | The spool directory contains spooled messages stored by SMTP server. |
sql | The sql directory contains SQL scripts creating database structure. |
temp | The tmp directory is used by LDA to store temporarily message files which was not assigned physical message identifier. These files will be moved to the data directory after server assigns physical message identifier. |
Disk Cleanup Cron
The Disk Cleanup cron helps you free up space on mail server's hard disk by searching for messages and message files that can be deleted or compressed.
Target Categories in Disk Cleanup Cron
There are two different types of categories that Disk Cleanup targets when it performs the job.
- Expunge Old Messages and Message Files
It expunges messages and message files that are stored in specfic mailbox and older than specific period of time from now. You can specify the mailboxes and periods by setting the expunge_after parameter in default.properties. This parameter is consist of pairs of mailbox name and period.
- Compress Old Message Files
It compresses message files that are older than specific period of time from now. The files are still available, but there will be a slight increase in access times because the files will be decompressed every time they are accessed. You can specify the period by setting the compress_after parameter in default.properties.
Schedule Disk Cleanup
You might want to set the cron to run daily or weekly depending on what works best for you. To schedule Disk Cleanup Cron to run on a regular basis we need to edit the applicationContext.xml from conf directory of your installation. Change the cronExpression to what you want to.
<bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail" ref="diskCleanupJob" /> <!-- Run every day at 3 AM --> <property name="cronExpression" value="0 0 3 * * ?" /> </bean>
The cronExpression is a string that is actually made up of seven sub-expressions, that descibe individual details of the schedule. These sub-expression are separated with white-space, and represents:
- Seconds
- Minutes
- Hours
- Day-of-Month
- Month
- Day-of-Week
- Year (optional field)
See the Quartz Enterprise Job Scheduler Tutorial for more information about cron expression.
Overview
The Hedwig Web Console is a web based administration tool for working with Hedwig Mail server.
Running the Web Console
Download the hedwig-web-version.war file and install the war distribution. Then you can point your web browser at the URL.
- http://localhost:8080/hedwig-web-version/
And hey presto, you should now have the Web Console running.
Configuring the Web Console
Copy default.properties from Hedwig server's conf directory to WEB-INF. Web Console is used by limited number of users, so change the jdbc.maxActive and jdbc.maxIdle value to smaller value.
To enable access to the Web Console, you must create a new username/password combination and associate the role name manager with it. Web Console defaults to a properties file stored at WEB-INF/users.properties, which can be edited with any text editor. This file might look like this:
admin=s3cret:manager
which defines the username and password used by this individual to log on, and the role names he or she is associated with.
Using the Web Console
Accounts
You can create, update or delete accounts in this menu.
And you can import multiple accounts using Import menu. Accounts are imported using a colon delimited text file. The following fields are required for accounts import.
Field | Form |
---|---|
Address | The email address of the account. |
Password | The password of the account. |
Maximum size | The maximum disk space that the account may use. |
Forwarding | The email address you want to forward messages to. |
If fields are empty or omitted, default value is used for that field. Following is a sample import file.
joe@domain.com:s3cret:1024:joe@gmail.com bill@domain.com jane@domain.com:tiger: kara@domain.com:::nicole@nate.com
Fetch Account
Hedwig can download messages from POP3 accounts on other servers. Email downloads are delivered to the selected account. You can fetch external account from Fetch menu in the Edit Account page.
- Name
The name of the external account. The name is in free text and can be anything you like.
- Protocol
Currently only POP3. Support for other protocols, such as IMAP, may be added in future.
- Server address & TCP Port
The hostname and TCP/IP port of the server should connect to when downloading messages.
- User name & Password
The user name and password the server should use when login to the external server. This should be the same information that you normally enter in your email client when login to that account.
- SSL
If the external server requires an encrypted connection(SSL), check the Use SSL option.
- Settings
If you select Delete messages immediately, server will delete the messages from the external server right after downloading them. The opposite, Do not delete messages, causes server not to delete messages on the external server.
Aliases
You can create, update or delete aliases in this menu.
Aliases are used to forward email from one specific address to another. Imagine them as addresses without a mailbox; instead of having their own mailbox, they store received messages in another account's mailbox. This can be useful if you want to monitor several email addresses, but only have one real email account on the server. For example, you may want to receive email messages sent to webmaster@domain.com, feedback@domain.com and yourname@domain.com, but you just want to create the webmaster@domain.com account instead of 3 different accounts. Then feedback@domain.com and yourname@domain.com can be made aliases of webmaster@domain.com.