Hi.
I am running Exim on a few systems that are connected to the Internet only by
dialup lines. One annoyance that has become apparent is that if a remote host
is down or unreachable, or there is some similar problem that stops a message
being delivered, then the mail stays (obviously) in the local queue, and it's
necessary to dial out repeatedly to do retries. This can be quite an
expensive business, especially since down hosts often stay that way for a
while.
An easy solution to this would be to route all outgoing non-local messages via
a smarthost at the ISP. However, this often introduces a delay, and some of
my users are very keen on having their mail delivered as soon as is humanly
possible. I've had smarthosts sit on outgoing mail for hours or even days in
the past, so I don't want to do this routinely.
It occurred to me, then, that it would be handy to have a way to arrange for
the first delivery attempt to proceed directly using SMTP to the recipient and
the lookuphost router or whatever (and this would succeed in the vast majority
of cases) but for the few messages that do fail to be handed off to a
smarthost so that it can do the retries. Being in a reckless frame of mind, I
came up with the attached patch to the domainlist router. With this, you can
have something along these lines in your configuration file:
smarthost:
driver = domainlist,
transport = smtp;
route_list = "* post.demon.co.uk bydns fallback"
lookuphost:
driver = lookuphost,
transport = smtp;
and the `smarthost' router will only succeed for addresses that have been
troublesome in the past. That's the theory, anyway.
So, my questions are these:
Am I at all justified in thinking that this is a real issue? Should I instead
swallow my distrust of smarthosts and use one routinely for all mail?
and
If so, is this at all the right way to go about solving the problem? Is there
some cunning Exim feature I've missed that will do this already? Does anybody
have a better patch?
Many thanks.
phil
--- clean/exim-1.62/src/routers/domainlist.c Wed Apr 16 14:34:51 1997
+++ exim-1.62/src/routers/domainlist.c Thu Jul 24 01:47:50 1997
@@ -214,6 +214,7 @@
BOOL matched = FALSE;
BOOL free_routelist_item = FALSE;
BOOL individual_transport_set = FALSE;
+BOOL fallback_only = FALSE;
int lookup_type;
host_item *h, *prev, **hchain;
char *routelist_item = NULL;
@@ -387,7 +388,8 @@
term = *options;
*options = 0;
- if (strcmp(s, "byname") == 0) lookup_type = lk_byname;
+ if (strcmp(s, "fallback") == 0) fallback_only = TRUE;
+ else if (strcmp(s, "byname") == 0) lookup_type = lk_byname;
else if (strcmp(s, "bydns") == 0) lookup_type = lk_bydns;
else if (strcmp(s, "bydns_a") == 0) lookup_type = lk_bydns_a;
else if (strcmp(s, "bydns_mx") == 0) lookup_type = lk_bydns_mx;
@@ -420,6 +422,14 @@
options++;
while (*options != 0 && isspace(*options)) options++;
}
+ }
+
+/* If this is a fallback-only route, do nothing unless we've tried and failed
+at least once already. */
+if (fallback_only == TRUE && addr->dr_retry_exists == FALSE)
+ {
+ log_write(5, LOG_MAIN, "not routing %s via fallback", addr->orig);
+ return FAIL;
}
/* Deal with the case of a local transport. A single host is allowed (can