January 20, 2011

 Logrotate for Atmail 6 logs

Configuring Logrotate is critical, so as to reduce the size of the files used by Atmail in the webmail/log directory. To implement logrotate for your server, please do the following:

- create a file in /etc/logrotate.d/ called 'logrotate_atmail_log'

- in the file, put:
/usr/local/atmail/webmail/log/*log {
    missingok
    notifempty
    sharedscripts
    postrotate
/etc/init.d/atmailserver restart >/dev/null 2>&1 || true
    endscript
}
- start logrotate:

% /usr/sbin/logrotate /etc/logrotate.conf

This will then manually execute the log rotation process.


Filed under: Uncategorized — John Contad @ 9:38 pm

 

January 18, 2011

 Creating Mailing Lists in Atmail 6.x

As some may have noticed, the method used for mailing list creation in Atmail 5.x no longer works with Atmail6. There is however a solution to creating mailing lists for Atmail 6. The easiest way, if you have many users to add at once is to use the batch-alias-create.php script described here. Create a csv file like such:

Deliver,list@domain.com,user1@dom.com;user2@dom.com;user3@dom.com;...etc

(If you have more than one mailing list you wish to create then put the details for each one on a new line in the csv file.)

With the example above a "deliver locally and alias" alias will be created which will result in all mail sent to list@domain.com also being forwarded to each email address specified (note that the "forward-to" addresses are separated by a semi-colon ";" not a comma ","). The effect of this is the same as the old style Atmail 5 mailing list; list@domain.com will receive a copy of all emails and they will also be forwarded to everyone in the "list".

To add single addresses to the mailing list just go to Webadmin > Services > Mail Aliases, select "Local Alias" as the alias type, enter the address of the list in the "Local Email Address" field and the address of the user you wish to add in the "Forward To" field, then click "Add Alias".

To delete addresses from the list simply find in the table the entry or entries you wish to delete, check the checkbox then click "Delete Selected". You may wish to type in the name of the list or the name of the account in the "Filter by domain" field at the top if you have many entries in the table, just to make your target easier to find.

And that is about it. Pretty simple!


Filed under: Atmail 6, maintenance tools, Hints and Tips — Brad Kowalczyk @ 8:15 pm

 

 Batch Creation of Aliases in Atmail

If you have many aliases you wish to define for Atmail then it can become tedious using the Webadmin UI. With this in mind we have created an easy to use CLI script to overcome the problem of bulk/batch adding of aliases into Atmail.

First up download the script from here. Then extract into place with this command: tar xvzf batch-alias-create.php -C /usr/local/atmail/webmail. You will then find the script located at /usr/local/atmail/webmail/utilities/tools/batch-alias-create.php

The script usage is as such:

#php batch-alias-create.php /path/to/csv

The csv file should take the following format:

alias-type,alias-name,forward-to

Where alias-type can be either:

1. Local - divert email from the address given in alias-name to the address/es given in forward-to

2. Deliver - deliver to the address given in alias-name and also forward to the address/es in forward-to

3. Domain - Catch all email going to the domain specified in alias-name and forward it to the address/es in forward-to

4. Virtual -  Forward all email from the domain in alias-name to the domain in forward-to

5. MailDir - store any email's coming to the address in alias-name at the path defined by forward-to

Where alias-name is either an email address or a domain name, depending on alias-type
Where forward-to is either an email address, a list of email addresses (separated by a semi-colon ; ) or a domain name, depending on alias-type.

Here is a sample csv file:

MailDir,brad@test.com,/usr/home/brad/mail
Deliver,list@test.com,brad@test.com;brad@atmail.com;brad@domain.com
Local,brad@nothere.com,brad@domain.com
Virtual,testing.com,test.com
Domain,cool.com,brad@test.com

So the first line creates a MailDir Alias (as it is called in Webadmin) which stores any mail sent to brad@test.com at /usr/home/brad/mail.

The second line creates a "Deliver Locally and Alias" alias, which forwards a copy of any mail for list@test.com to brad@test.com, brad@atmail.com and brad@domain.com (it also delivers a copy to list@test.com). Notice that the forward-to addresses are separated by a semi-colon ( ; ) and not a comma ( , )

The third line creates a "Local Alias", so  that any email received for brad@nothere.com is forwarded to brad@domain.com (you can specify multiple forward-to recipients, separated by a semi-colon ; )

The fourth line creates a "Virtual Domain Alias" where any mail received for any user @testing.com is forwarded to that same user @test.com (so for eg. mail for brad@testing.com will be forwarded to brad@test.com).

The fifth line creates a "Domain" or "Catch All" alias, where any email sent to any user at cool.com is forwarded to brad@test.com

This script is also very useful for creating mailing lists as described in this kb article. We hope you find this script helpful.


Filed under: Atmail 6, maintenance tools, CLI tools — Brad Kowalczyk @ 7:37 pm

 

 new MailRelay table for mysql replication

If your slave MySQL is out of sync with your primary MySQL, please do the following via MySQL command prompt.

drop table MailRelay;

CREATE TABLE `MailRelay` (
`IPaddress` varchar(16) NOT NULL default '',
`DateAdded` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`Account` varchar(128) default NULL,
`id` bigint(20) unsigned NOT NULL auto_increment,
PRIMARY KEY (`id`),
KEY `DateAdded` (`DateAdded`),
KEY `IPaddress` (`IPaddress`),
KEY `Account` (`Account`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


Filed under: Uncategorized — Stewart Bazley @ 2:49 pm