How to set up SMTP on Windows Server 2003 to forward all emails to a given address

emailemail-serversmtpwindows-server-2003

I'm setting up an internal SMTP server to handle software tests which involve the sending of emails.

I want to configure the server so that any emails sent to myinternaldoamin.com get relayed (is that the correct term?) to our real/main SMTP server (another machine on the same network). Emails being sent to any other domain need to be forwarded to externalemailtest@myinternaldomain.com – so they dont actually go to real people, I want to trap them on this account just for testing.

Is this possible?

If so, can someone give me a quick tut on how to do it?

Edit: If what im asking isnt possible in the way im asking, then im open to suggestions on how to achieve the same effect.

Thanks

Andrew

Best Answer

Not only possible, but easy :-)

Unfortunately I haven't got a server to hand with just the SMTP service on it (only Exchange and this messes with the SMTP config interface). From memory if you go into the SMTP server config you can add domains and for each domain you add you configure the mail delivery. The domain can be local, in which case the mail is stored on your server, or remote. For remote domains you can configure the mail to route to a different server.

So you just set up a domain myinternaldoamin.com as a remote domain and configure the mail to deliver to your "real" mail server.

JR

Edit:

The Windows SMTP server can't modify mail headers. It can only pass on mails unchanged. However the Windows SMTP server allows you write event sinks. These are bits of VBScript that get executed whenever mails pass through the server, and from this code you can make any changes you want to the e-mail. This is often used to implement a catchall mailbox, as neither the Windows SMTP server nor Exchange 2k/2k3 provide this. I would be wary of writing synchs for production servers as you have to make damn sure there are no bugs in them and you document them thoroughly. However for the use you suggest they should be fine.

http://support.microsoft.com/kb/324021 is a good place to start. This describes writing a catchall script for Exchange, but you should be able to adapt it for your requirements.

JR