[Mimedefang] Autoresponse to old domain

Ashley M. Kirchner ashley at pcraft.com
Thu Apr 3 15:55:01 EST 2003


Shawn Button wrote:

>We recently changed our company and thus e-mail domain name. Our server
>is now set up to receive mail for both domains (ie old.domain.com and
>new.domain.com). Is there a way to set up an auto responder that
>whenever a mail is sent to old.domain.com it is delivered but a response
>is sent to the sender stating something like, "thanks for contacting
>old.domain.com. Your message has been delivered but please note our new
>e-mail domain is new.domain.com."
>
    One way to do it is to deliver messages to different mailboxes using 
virtusertable.  Bit of a pain depending on how many users you have, and 
how much mail you get, but I had to do this a few years back and it worked.

    Basically what I did was first create a catchall mailbox (in my 
case, I created a user called 'relay')
    Then I created a main virtusertable file on the mail server that has 
entries like this:

    user1 at old.domain.com    user1, relay
    user2 at old.domain.com    user2, relay
    ...
    user1 at new.domain.com    user1
    user2 at new.domain.com    user2
    ...
    relay at old.domain.com    relay

    What this did was, all email coming in for @old.domain.com got 
delivered to the respective recipient, but it also got redirected to the 
'relay' catchall box.  That 'relay' user then had a vacation file that 
would get fired back to the sender saying that their email has been 
delivered, but to use new.domain.com in the future.  Now, emails coming 
in @new.domain.com would go straight to the final recipient and would 
never hit the 'relay' account.

    Keep in mind, this was a few years back that I did this.  Nowadays, 
if I had to do the same thing, I'd use a global procmailrc file.  Parse 
out the recipient domain, and if it's the old one, send a note back to 
the sender.  This is much cleaner and in some cases easier to do.  One 
file takes care of everyone, and everything.  I use this technique 
nowadays to fire back instructions to people who email us at our 
webmaster or websmith emails:

# cat .procmailrc

SENDMAIL = "/usr/sbin/sendmail"
TAG = ""
to_ = '^((Apparently-)?To|Cc|Resent-From|Reply-To):(.*\<)?'

:0 h c
    * ^TO_websmith at pcraft.com
    * !^FROM_DAEMON
    * !^X-Loop: websmith at pcraft.com
    | (formail -r -I"Precedence: junk" \
       -A"X-Loop: websmith at pcraft.com" ; \
       cat /etc/canned/webmaster.msg) | $SENDMAIL -t


    Take the above recipe, adjust the TO field to scan for the 
old.domain.com suffix and in essence you're done.  In the above example, 
email sent to websmith at pcraft.com will still get delivered, but the 
sender will also get the canned response send back to them.  (I don't 
have time to answer every single piece of email that comes in at that 
address, so the canned response tells them to either wait, or redirect 
their message to a different email where they may get someone who can 
help them right away.)

-- 
W | I haven't lost my mind; it's backed up on tape somewhere.
  +--------------------------------------------------------------------
  Ashley M. Kirchner <mailto:ashley at pcraft.com>   .   303.442.6410 x130
  IT Director / SysAdmin / WebSmith             .     800.441.3873 x130
  Photo Craft Laboratories, Inc.            .     3550 Arapahoe Ave. #6
  http://www.pcraft.com ..... .  .    .       Boulder, CO 80303, U.S.A.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3241 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.mimedefang.org/pipermail/mimedefang_lists.mimedefang.org/attachments/20030403/d7e21852/attachment.bin>


More information about the MIMEDefang mailing list