I have an email macro using CDO working perfectly, although whenever I need to email to an external email address our exchange person has to set up a relay specifically for that address due to error "Server rejected one or more recipients. Relaying is prohibited".

Our email people want to move away from relay due to belief it leaves us open to security issues. I've been trying to modfiy the macro so that instead of anonymous mode, it is now authenticated. However I still get the same error message.

Is this the right approach? How can I get this code working without using relay?

Cheers, K.


ORIG
[vba]cdoSMTPAuthenticate = cdoAnonymous[/vba]

NEW

[vba]Private Sub ConfigMessage(iMsg As CDO.Message)
Dim iConf As New CDO.Configuration
iConf.Fields(cdoSendUsingMethod) = cdoSendUsingPort
iConf.Fields(cdoSMTPServer) = "ourExchangeServer"
iConf.Fields(cdoSMTPConnectionTimeout) = 30
iConf.Fields(cdoSendEmailAddress) = "anyEmailAdress@OurExchangeServer"
iConf.Fields(cdoSMTPAuthenticate) = cdoBasic
iConf.Fields(cdoSendUserName) = "validEmailAccount@OurExchangeServer"
iConf.Fields(cdoSendPassword) = "passwordForEmailAccountAbove"

iConf.Fields.Update
iMsg.Configuration = iConf
End Sub[/vba]