January 16, 2007

 Toggle forward-and-copy router

For users who want a per-user forward-and-copy setting, just do the following:- open up /usr/local/atmail/mailserver/configure

- find this line:

MYSQL_DOMAINS = select Hostname from Domains where Hostname='${quote_mysql:$domain}'

- below it, add:

MYSQL_FORWARDCOPY = select Forwardcopy from Users where Account='${quote_mysql:$local_part}@${quote_mysql:$domain}'

- then, find:

forward_director:
driver = redirect
data = ${lookup mysql {MYSQL_FORWARD}{$value}}

- change this to:

forward_director:
driver = redirect
data = ${lookup mysql {MYSQL_FORWARD}{$value}}
unseen = ${lookup mysql {MYSQL_FORWARDCOPY}{$value}}

- save changes, and restart Exim

% kill -HUP exim

- then, create a MySQL column:

> alter table Users add Forwardcopy varchar(3) DEFAULT "no";

- set the users you want to disable forward-and-copy as:

> update Users set Forwardcopy="yes" where Account="foo@bar.com";

Where foo@bar.com is the user's account.


Filed under: Exim, Linux version — info @ 5:33 am

 

 Exim router to broadcast message to all users

Question: I would like to create an email account, which automatically broadcasts a message to all user accounts on the @Mail system.For example, using the email allusers@mydomain.com, been able to email this via Webmail or Outlook.

How can I create a custom rule via Exim to achieve this, without having to manually create an email-alias with all users on the system?

Answer: This is possible by making a new router in Exim.

Edit the file:

/usr/local/atmail/mailserver/configure

Add:

MYSQL_ALLUSERS = select Account from UserSession

To the SQL query part of the configure file, next define the new router, locate:

groupmail_lists:
driver = redirect
local_part_suffix = -group
data = ${lookup mysql {MYSQL_GROUPLOOKUP}}
forbid_file
forbid_pipe
skip_syntax_errors

Under this router append:

groupmail_allusers:
driver = redirect
domains = +local_domains
local_parts = allusers
data = ${lookup mysql {MYSQL_ALLUSERS}}
forbid_file
forbid_pipe
skip_syntax_errors

This defines, if the local-user allusers@mydomain.com is emailed, all users on the system will receive the message automatically via the MYSQL_ALLUSERS SQL query.

You can optionally only allow access to a specified email sender, so only a trusted user can send by appending

senders = admin@mydomain.com

Make sure this user exists as a local account in @Mail first, and messages will only be accepted from this address.

Save changes, then reload @Mail services:

/etc/init.d/atmailserver restart

You can test the router by using:

/usr/local/atmail/mailserver/bin/exim -v allusers@mydomain.com
This will output all the users the email is sent to.

Filed under: Exim, Linux version — info @ 3:39 am