make sendmail use MX before local routing
am 14.10.2007 15:41:34 von Todd Wade
Hello,
I am working on setting up a new messaging server and would like to
use the old one as the backup. I've gotten everything done except for
routing the mail sent by the old server. I would like sendmail to try
to send the mail to the new messaging server, and if that fails send
the mail to the local account.
Before the new messaging server all services were ran on one machine.
Email for many different domains are handled by this machine.
Accepting email for different domains is configured by /etc/
domainaliases.
So say the machine's name is example.org and there is a system account
webappuser. For this machine to accept mail for
webappuser@example.com, the following line is in /etc/domainaliases:
webappuser@example.com webappusercom
And then to place the email received for webappuser@example.com in
webappuser's mailbox there is the following entry in /etc/aliases:
webappusercom webappuser
I have the new mail server set up and configured. If I invoke mail
from an external system and address it to webappuser@example.com, it
arrives in the inbox on the new server. But if I invoke the mailer on
the old mail server and address it to webappuser@example.com, it still
goes to the inbox on the old machine.
How can I tell the sendmail on the old machine to try to relay the
local mail to the new messaging server and only deliver to the system
user if the relay fails?
Thank you,
trwww
Re: make sendmail use MX before local routing
am 18.10.2007 15:36:32 von Bill Cole
In article <1192369294.722653.171600@v23g2000prn.googlegroups.com>,
Todd Wade wrote:
> Hello,
>
> I am working on setting up a new messaging server and would like to
> use the old one as the backup. I've gotten everything done except for
> routing the mail sent by the old server. I would like sendmail to try
> to send the mail to the new messaging server, and if that fails send
> the mail to the local account.
>
> Before the new messaging server all services were ran on one machine.
> Email for many different domains are handled by this machine.
> Accepting email for different domains is configured by /etc/
> domainaliases.
>
> So say the machine's name is example.org and there is a system account
> webappuser. For this machine to accept mail for
> webappuser@example.com, the following line is in /etc/domainaliases:
>
> webappuser@example.com webappusercom
>
> And then to place the email received for webappuser@example.com in
> webappuser's mailbox there is the following entry in /etc/aliases:
>
> webappusercom webappuser
One thing you have to understand is that this approach is very likely to
have been a descendant of the best an inventive admin could do with
sendmail 8.7.x or so, circa 1996. The 'domainaliases' file is not part
of any standard Sendmail feature set today and I don't believe it ever
was, although Google has hints that it might have been a RedHat
invention in that era. The fact that your sendmail config files are in
/etc instead of /etc/mail is a hint that this is an antique system.
I make that point because it reduces the field of people with the
chutzpah to try to help without a lot more detail about your existing
system, and even with more details a lot of people who remember
administering Sendmail in the mid-90's may not want to trigger our
collective PTSD...
> I have the new mail server set up and configured. If I invoke mail
> from an external system and address it to webappuser@example.com, it
> arrives in the inbox on the new server. But if I invoke the mailer on
> the old mail server and address it to webappuser@example.com, it still
> goes to the inbox on the old machine.
>
> How can I tell the sendmail on the old machine to try to relay the
> local mail to the new messaging server and only deliver to the system
> user if the relay fails?
You can't do exactly that, either with antique Sendmail or modern
Sendmail. With a modern version (anything with Milter support) you could
build a milter to do a look-ahead on specific addresses and determine
for sendmail what the right delivery point is, but with older versions
you'd have to build this into a custom mailer. Note that both of those
solutions would include writing a minimal SMTP client, a deeper project
than this is likely to justify.
Assuming that you want to do this for a migration, not as a permanent
mode of operation, a better approach would be to modify aliases or use
~/.forward files as you migrate individual users and adjust your
configuration of what domains are local (maybe /etc/local-host-names,
maybe something else, depending on how your Sendmail is configured...)
as you get entire domains moved to the new server.
If you are envisioning this as a permanent mode of operation where
failures on the new system result in local delivery on the old server, I
urge you to reconsider with particular thought given to the usage model.
Local delivery is final, so that sort of setup would leave mail sent to
individual addresses scattered between systems without any way for users
to be sure where their mail might have been delivered.
--
Now where did I hide that website...