[AccessD] Error Sending Emails Through Exchange

John Bodin jbodin at sbor.com
Mon Mar 17 16:38:29 CDT 2014


David, it sounds like Exchange doesn't like the 'relaying' of your email.  Typically when you setup a copier or email station that will allow users to send email to the outside world through Exchange, you have to set up a relay permission in Exchange with the IP address of the device that will be attempting to send emails through it.  It's pretty easy to setup however if you have a lot of workstations that will be using this program, that will not work too well.  

Also some A/V programs will block as well, like McAfee.  Out of the box it defaults to "Prevent Mass Mailing Programs..." so it blocks email traffic from say a backup program on the workstation that you setup to have the results emailed to you each night or you are using something like FMS Inc's Total Access Emailer.

-hth

John

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David A Gibson
Sent: Monday, March 17, 2014 5:24 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Error Sending Emails Through Exchange

We used to send emails by Word mailmerge until an Exchange update screwed that up for us.  Now it's hit or miss.  

David Gibson

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David Emerson
Sent: Monday, March 17, 2014 3:54 PM
To: AccessD
Subject: [AccessD] Error Sending Emails Through Exchange

Hi Listers,

 

Below is the error message my Access database is getting when I try to send out an email using cdosys.dll:

 

Error Number : -2147220977

Error Msg: The server rejected one or more recipient addresses.  The server response was: 550 5.7.1 Unable to relay.

 

The VBA code I am using is below:

 

    Dim msg As Message, strSMTPServer As String, intSMTPConnectionTimeout As Integer, intSMTPServerPort As Integer

    Dim strOrganisation As String, strFrom As String, strSubject As String, strBody As String, strHeader As String

 

    strSMTPServer = DLookup("EmailSMTPServer", "tlkpVariable", "VariableID =
1")

    intSMTPConnectionTimeout = DLookup("EmailSMTPConnectionTimeout",
"tlkpVariable", "VariableID = 1")

    intSMTPServerPort = DLookup("EmailSMTPServerPort", "tlkpVariable", "VariableID = 1")

    strOrganisation = DLookup("EmailOrganisation", "tlkpVariable", "VariableID = 1")

    strFrom = DLookup("EmailSender", "tlkpVariable", "VariableID = 1")

    strSubject = DLookup("EmailSubject", "tlkpVariable", "VariableID = 1")

    strBody = DLookup("EmailBody", "tlkpVariable", "VariableID = 1")

 

        Set msg = CreateObject("CDO.Message")

        With msg

            With .Configuration.Fields

                .Item(cdoSMTPAuthenticate) = cdoAnonymous

'                .Item(cdoSMTPAuthenticate) = cdoBasic

'                .Item(cdoSendUserName) = "username"

'                .Item(cdoSendPassword) = "password"

                .Item(cdoSendUsingMethod) = cdoSendUsingPort

                .Item(cdoSMTPServer) = strSMTPServer

                .Item(cdoSMTPConnectionTimeout) = intSMTPConnectionTimeout

                .Item(cdoSMTPServerPort) = intSMTPServerPort

                .Update

            End With

            .Organization = strOrganisation

            .To = strTo

            .Subject = Nz(strSubject, " ")

            .TextBody = Nz(strBody, " ")

            .From = strFrom

            .Send

        End With

        Set msg = Nothing

   

 

The lines in red above have also been tried using the users windows logon and password but the same message appeared (not sure if this was the correct data for these properties though).

 

The code has worked fine for other clients but they have not used Microsoft Exchange for their emails.

It also works if the recipient address has the same domain as the server.

 

Any help would be appreciated.

 

Regards

David Emerson
Dalyn Software Ltd
Wellington, New Zealand

 

 

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list