Hi All,
I have been tasked with making an application in Access/VBA which can send emails. I am playing with some code that uses CDO to create and send the message via the server in the office which is running SBS 2008. What I have done so far worked ok with messages on my own domain but failed with the following error message if I attempted to mail an external address:
“The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay”
I got past this problem by following some other forum advice and created a ‘Receive Connecter’ in Exchange (not sure if this is correct). Either way this didn’t work but generated a new error:
“The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available”
This is where I am stuck as I can’t find any useful info on this second error. Please help! Oh and bear in mind I have only modest VBA knowledge, and am rubbish with Exchange! Here’s my code:
I have been tasked with making an application in Access/VBA which can send emails. I am playing with some code that uses CDO to create and send the message via the server in the office which is running SBS 2008. What I have done so far worked ok with messages on my own domain but failed with the following error message if I attempted to mail an external address:
“The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay”
I got past this problem by following some other forum advice and created a ‘Receive Connecter’ in Exchange (not sure if this is correct). Either way this didn’t work but generated a new error:
“The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available”
This is where I am stuck as I can’t find any useful info on this second error. Please help! Oh and bear in mind I have only modest VBA knowledge, and am rubbish with Exchange! Here’s my code:
Code:
Private Sub cmdGo_Click() Dim iMsg As Object Dim iConf As Object Dim strBody As String Set iMsg = CreateObject("CDO.Message") Set iConf = CreateObject("CDO.Configuration") iConf.Load -1 Set Flds = iConf.Fields With Flds .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "*****" .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "*****" .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "192.168.**.**" .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 .Update End With strBody = "...html email body." With iMsg Set .Configuration = iConf .To = "me@external.com" .Sender = "me@mydomain.com" .Subject = "Email Is Awesome" .HTMLBody = strBodyMerged .Send End With End Sub
Comment