Friday, 14 September 2012

Exchange 2007 Send As from a different domain

Imagine this scenario, it may be one you've come across:

  • the organisation you're working for / consulting to has a single Exchange Server (be it standalone or part of SBS)
  • You have it receiving multiple domains e.g. example1.com and example2.com
  • Users would like to send from name@example1.com and from name@example2.com
Exchange does not support this without either adding an additional mailbox for example2.com to each user's Exchange account or implementing some expensive third party software. 

There is an easier way to do this and it has two separate parts to it: creating a relay for example2.com via the Exchange server, and setting up a dummy POP3/SMTP client in outlook to send as the second domain using the "From" drop down in the create email window in Outlook.

Part 1 - Setting up an additional SMTP Relay to avoid the dreaded 550 5.7.1 Unable to Relay

The Exchange server won't necessarily allow mail from a different domain to be relayed through it to the outside world. In Exchange 2007 you don't add a an extra SMTP relay, you have to add a New Receive Connector (because the server is receiving the mail to then send it on). 

Firstly add an IP address to your Network adaptor - don't try to re-use the existing IP address, this will over complicate things. Simply add an extra address - increment your existing address by one, or find a free one. This will be the outgoing SMTP server address we set up later in Outlook so note it down.

Open the Exchange Management Console and go to Server Configuration. Hit Hub Transport and choose "New Receive Connector"

Name it, and choose Custom as the intended use for the Receive Connector. Hit Next and on the Local Network Settings page, click the Add button and type in your new IP Address. Leave the port at 25 - most mail programs don't like this to be messed with.

Remove the "All Available" Local Network address and hit Next again.

The next window should be the Remote Network Settings window - use this to control which addresses can relay through the server. Ensure you put in a range that is meaningful and allows for some security. If you put in too large a range, or do 0.0.0.0 to 255.255.255.255 you have created an Open Relay and spammers love these - probably not the best plan to do that. Pick your DHCP range or something similar to lock it down to.

Choose Next and on the Summary screen click New to create the connector. OK so now we need to alter the permissions.

On the properties page of the new Connector (right click and choose Properties), choose the Permissions Groups tab and select the checkbox next to "Exchange Servers" and hit Apply.

Go to the Authentication tab and select the checkbox next to "Externally Secured (for example, with IPsec)", and hit Apply and OK.

Now we can relay through our server.

Part 2: Configure a Dummy Outlook Account to get access to the extra "From" option in Outlook

Open Outlook on your desktop and go to Options, then Accounts and create a new POP account.

Put in the User's name, their email address and then for the POP3 Server address put in a dummy address pop.local for example. Put the IP address you configured above in to the SMTP server and click finish. The Test button won't work - the POP account will fail every time. Because we have only a single mailbox with multiple addresses assigned to it in Exchange, we don't have to worry about where emails sent to example2.com land - the Exchange server will automatically put them in the correct folder.

Open Tools again, Options and go to the Send/Receive section and disable "Receive email items" from our new dummy account. Restart Outlook. 

Now when you open an email to send to someone, you'll see the "From" button beside the sender's address at the top and you can select your example2.com account.

I hope you find this useful - I've cobbled it together from two separate issues that ended up being interrelated.

No comments:

Post a Comment

Adventures with Immich

With the implementation of my Proxmox server it's now time to play with some new applications - and we'll start with Immich, a repla...