Question : Workaround for CDO email msg error when sending external emails?

I'm working on an MS Access application that cycles through email addresses and sends an email w/attachments using the CDO message handler.
It works great for email addresses on the local server, but when I try to send to an external email address - I get the error: "-2147220977 - The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for [email protected]" (where emailaddress is an external email address).

I'm able to send emails from our local network to external folks with MS Outlook fine, so I'm hoping that there is a workaround or another email command I can use with MS Access to accomplish this task?

Here's a code snippet of the method I've been trying to use:
Set objMessage = CreateObject("CDO.Message")
    '==Configuration information for the remote SMTP server.
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    'Name or IP of Remote SMTP Server
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "I put the local server in here"
     'Server port (typically 25)
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
     objMessage.Configuration.Fields.Update
    '==End remote SMTP server configuration section==
 
'==Send Email== (contained within a do...loop)
objMessage.Subject = Me.Subject
objMessage.From = Me.From
objMessage.To = rst!Email
objMessage.HTMLBody = Me.Body
objMessage.Send

Thanks for any inputs :)

Answer : Workaround for CDO email msg error when sending external emails?

Does you local server require authentication? Your Outlook account configuration would tell you.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
Const cdoAnonymous = 0       ' Do not authenticate
Const cdoBasic = 1           ' Basic (clear-text) authentication
Const cdoNTLM = 2            ' NTLM
 
 
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Simple plain text CDO example"
objMessage.From = """My name"" "
objMessage.To = "[email protected]"
objMessage.TextBody = "This is a test (sent using SMTP authentication)"
 
' Configure the send to use another server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
 
 
' Set the name or IP of the remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.myisp.com"
 
 
' Set the type of authentication to use, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
 
 
' Set your UserID on the SMTP server (some SMTP servers require your e-mail address)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "userid"
 
 
' Set your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
 
 
' Set the server port (usually 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
 
 
' Set if the connection should use SSL (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
 
 
' Set the connection timeout in seconds
' (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
 
 
' Save the new configuration settings
objMessage.Configuration.Fields.Update
 
 
objMessage.Send
 
** Courtesy Of: http://www.pa-software.com/scripts/?tp=vbs&sc=cdoemail
Open in New Window Select All
Random Solutions  
 
programming4us programming4us