On 27 Oct 2004, Genady Perchenko wrote:
[verifying recipients at SMTP time from backup MX]
> > a) (the VERY easy way) use recipient callouts.
> would that add an overhead to the main server that is busy as it is
> since it did not pickup email in the first place.
Possibly. However, Exim has a callout cache which means that the secondary
will not necessarily make a connection to the primary every time a mail
comes in.
> What if prim is not available?
Then it's up to you. If this doesn't happen often, you can use the
callout_defer_ok option which will accept the mail. This gives you back
the original problem, but at least you will have solved it most of the
time.
> > b) push your valid recipient list to the secondary server(s).
> I really like this!! I would like to try it. In fact, I do have up to
> date mysql database with all valid email addresses maintained by the
> control panel. The format is not strait forward and would require some
> script to process, but I would be really interested in writing a small
> perl script that I can hook to exim and get it executed for each
> incoming email and let it decide a if email should be accepted for a
> delivery. Is this possible? If yes, can you refer me to some example?
Yes it is possible, although I don't know if it is with Exim 3. You have a
number of options:
- access the MySQL database directly
- write a Perl script which accesses the MySQL database directly and
produces a text file output, which you can then use in Exim (converting to
DBM/cdb or whatever if necessary). Having got a text file containing a
list of valid users, you just need a router to check this. Read this
thread containing a previous discussion on this topic with suggestions
from both myself and Peter B which has example routers:
http://www.exim.org/mailman/htdig/exim-users/Week-of-Mon-20040906/msg00137.html
- write a Perl script which is called for each e-mail. You could do this
with the ${run... condition
- if you're going to use Perl for each e-mail as above, you might be
better to write your script to run as a daemon, listening on a port/UNIX
socket. You can then use the ${readsocket condition to pass stuff to it
for each e-mail. There is an example with some framework code here:
http://users.aber.ac.uk/auj/spam/exim_sockd.pl.txt
Hope that helps,
Tim