SharePoint's out-going e-mail with Exchange 2007

When using SharePoint 2007 with Exchange 2007, I found out that SharePoint just couldn't send out *ANY* e-mails. This could be e-mail notifications from Workflow actions, or simply the "Welcome" e-mail from the "Add User" administration in the site collection. From Site Actions -> Site Settings -> People and Group, select New -> Add Users,

If you don't see the "Send welcome e-mail to the new users" part, then the "Out-going email settings" has not been configured in the Central Administration. (To do so, go to Central Administration's Operations page, Topology and Services, Out-going email settings).

Now, if our out-going email settings is pointing to Exchange 2007 Beta2, upon clicking on "OK" SharePoint will complain that the e-mail message couldn't be sent out.

To check what's going on, we will need to inspect the SharePoint log files, at <program files>\Common Files\Microsoft Shared\web server extensions\12\LOGS. The actual error message is: " #160005: Bad response from SMTP host'master.iventsys.com.my': 530 5.7.1 Client was not authenticated . "

Ah.. "Client was not authenticated". Exchange 2007, by it's hardened default state, will not allow anonymous clients to send e-mails.

First off, we will need to create a Receive Connector in Exchange 2007 to receive e-mail from Internet. From the Exchange Management Console, select Server Configuration -> Hub Transport, New Receive Connector.

Now, if we try to send SharePoint's Welcome E-mail again from the New User page, we will still get the same error on the web page. However, the SharePoint log file turns out a different message:

#160005: Bad response from SMTP host'master.iventsys.com.my': 550 5.7.1 Client does not have permissions to send as this sender .

"Client does not have permissions to send as this sender. " This is because SharePoint will use the user email in the "From Address" field of our Out-going Email Settings from the Central Administration's Operations page.

So, how can we enable Exchange 2007 to accept SharePoint's anonymous sender, masquerading as the administrator@iventys.com.my as above?

After searching throughout for this setting in Exchange 2007's Management Console, turns out that it never existed in the console. To do this, we have to use the management shell for Exchange. Referring to this article on Exchange 2007 Wiki: https://www.exchangeninjas.com/TUPMAppA; we need to do the following from the Exchange Management Shell:

add-adpermission '<receivername>' -User 'NT AUTHORITY\ANONYMOUS LOGON' -ExtendedRights ms-Exch-SMTP-Accept-Authoritative-Domain-Sender

where <receivername> is the name of our Receive Connector of Internet type created above.

And that's it! Now my SharePoint 2007 and Exchange 2007 can live together happily ever after (well, until the RTM at least).