A simple boune handler for Mojo Mail.
A few things have to be tweaked at the top of the script, let's get to that, first:
This script needs to be told specifically where you put the MOJO directory. usually, this will look like:
my $lib = '/home/account/www/cgi-bin/mojo';
you can list what addresses you don't ever want this script to filter out by listing them here, like this:
my @skip_addresses = qw(address1 address2);
Set this to '1' if you want bounces to be automatically removed.
Set this to an absolute path to keep a log of the bounced messages.
Set this to an absolute path to keep a log of all email addresses found in bounced messages
upload this file to your server and chmod it to 755. For starters, you may just want to install it in the same directory as mojo.cgi but it's better to put it in a more secure location that can't be accessed via a web browser.
Messages are received by this script via an aliased email address that points to this script. The email address should look like this:
bounce-listshortname@domain.com
every address that goes to this script should start out with 'bounce-'
listshortname is your list's shortname. A good shortname should be small, all lowercase and shouldn't contain any weird characters that can't be made into an email address. Only a valid short name can be created using Mojo version 2.6. Lists made with a previous version of Mojo Mail will have a shortname that may not work well with this script.
Set this address as your admin email address. All error messages will go to this address.
Make sure in the /etc/mail/sendmail.cf file that this:
# use Errors-To: header? O UseErrorsTo=False
is set to True:
# use Errors-To: header? O UseErrorsTo=True
Or this script just won't work.
Make a new alias in /etc/mail/aliases that looks like this:
# bounce handler for listname bounce-listname: "|mojo_bounce_handler.pl"
where listname is the name of your list's SHORT name. Add mojo_bounce_handler.pl to your list of things that the sendmail secure shell is allowed to use:
ln -s /home/justin/www/cgi-bin/mojo/mojo_bounce_handler.pl /usr/adm/sm.bin/mojo_bounce_handler.pl
Where '/home/justin/www/cgi-bin/mojo/mojo_bounce_handler.pl' is the absolute path to mojo_bounce_handler.pl
if you don't have a /usr/adm/sm.bin directory, make one:
sudo mkdir -p /usr/adm/sm.bin -m 755
Type:
newaliases
in a telnet or ssh session for sendmail to see the new alias that you made and then restart sendmail
You should be all set to go
In your home directory, make a new .qmail file, called:
.qmail-bounce-listname
where listname is the name of your list's SHORT name
in it, type:
|/home/account/www/cgi-bin/mojo/mojo_bounce_handler.pl
where '/home/account/www/cgi-bin/mojo/mojo_bounce_handler.pl' is the path to mojo_bounce_handler.pl
Save the .qmail file.
You should be all set to go