Matthew Thomas Broadhead wrote:
i would rather avoid having to list all users, but rather the email go to all users at that domain. also, i don't want anyone to be able to send emails to that address who isn't a user on the server if that is possible.

Please don't top-post, it makes these threads difficult to read.

Create a normal Courier user that will function as the mailing list, i.e. [EMAIL PROTECTED] Set up his home directory like you normally would. Now write a small script that will pull the email addresses of all persons in the system (this would be an ldapsearch if your using LDAP or a MySQL query, all depends on your backend). The script should return exactly one email address per line for all users of the system. Save the script to the everyone user's home and make sure the everyone user has execute permissions to it. Now in the everyone user's home directory create a .courier file with the line:

||./script.sh

Instead of following the normal delivery instructions (calling maildrop or putting the message in the Maildir), Courier will call the script and will use it's output to determine what addresses to send the message to. Note that according to the docs, if the script returns more than 8191 bytes, it will be truncated, this might not be true with more modern systems though, Sam may know better.

Now, if you want to lock down the everyone account to only internal mail...

create a .mailfilters directory in the everyone user's home and a rcptfilter file. Put the following in the rcptfilter:

----

import SENDER
import TCPREMOTEIP

if (!lookup ($SENDER, 'validfrom.txt'))
{
 echo "$SENDER, you are not authorized to send to [EMAIL PROTECTED]"
 EXITCODE=1
 exit
 }

if (!lookup ($TCPREMOTEIP, 'validip.txt'))
{
echo "$SENDER on $TCPREMOTEIP, your network is not authorized to send to [EMAIL PROTECTED]"
 EXITCODE=1
 exit
 }

exit

----

Now create a validfrom.txt file and a validip.txt file that defines who can send mail to the list. Something like:

[EMAIL PROTECTED]

would do fine for validfrom.txt and

10\.1\.*

would do fine for validip.txt (adjust as needed for your internal network range). Make sure smtpfilters is enabled by creating /etc/courier/enablefiltering and naming the esmtpd modules that you wish to filter (generally the file should only contain esmtp).

Have fun.

Jay
begin:vcard
fn:Jay Lee
n:Lee;Jay
org:Philadelphia Biblical University;Information Technology Department
email;internet:[EMAIL PROTECTED]
title:Network / Systems Administrator
x-mozilla-html:FALSE
version:2.1
end:vcard

Reply via email to