CDO Email / Transport Error

CharlesWhiteman

Registered User.
Local time
Today, 10:37
Joined
Feb 26, 2007
Messages
421
Hi All, I have just started redoing a database. They're going to be both the same but i am starting afresh in a new Db.

In the old one my cdo email works perfectly. all the data is the same and apart from a few field name changes (checked checked and checked again) the code works perfectly in the old one (open too on the same machine and works fine) but in the new one when sending i get a transport error.

any ideas??

Code:
Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).
Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM
Set objMessage = CreateObject("CDO.Message")
Dim strUser As String
strUserName = Forms.Frmsplashscreen.txtUserName
Dim strReplyAddress As String
strReplyAddress = DLookup("EmailAddress", "TblDbUsers", "DbUserID = Forms!FrmSplashscreen!txtDbUserID")
Dim strSignature As String
strSignature = DLookup("EmailSignature", "TblDbUsers", "DbUserID = Forms!FrmSplashscreen!txtDbUserID")
objMessage.Subject = Me.txtSubject
objMessage.From = strReplyAddress
objMessage.To = Me.txtEmailTo
objMessage.TextBody = Me.txtMessage & vbCrLf & vbCrLf & vbCrLf & strSignature
'==This section obtains user variables from TblDbUsers & the message text.
Dim strSMTPserver As String
strSMTPserver = DLookup("smtpMailGateway", "TblDbUsers", "DbUserID = Forms!FrmSplashscreen!txtDbUserID")
Dim strUserID As String
strUserID = DLookup("smtpUserName", "TblDbUsers", "DbUserID = Forms!FrmSplashscreen!txtDbUserID")
Dim strUserPassword As String
strUserPassword = DLookup("smtpPassword", "TblDbUsers", "DbUserID = Forms!FrmSplashscreen!txtDbUserID")
'==This section provides the configuration information for the remote SMTP server.
objMessage.Configuration.Fields.Item _
("[URL]http://schemas.microsoft.com/cdo/configuration/sendusing[/URL]") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("[URL]http://schemas.microsoft.com/cdo/configuration/smtpserver[/URL]") = strSMTPserver
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("[URL]http://schemas.microsoft.com/cdo/configuration/smtpauthenticate[/URL]") = cdoBasic
'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
("[URL]http://schemas.microsoft.com/cdo/configuration/sendusername[/URL]") = strUserID
'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
("[URL]http://schemas.microsoft.com/cdo/configuration/sendpassword[/URL]") = strUserPassword
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("[URL]http://schemas.microsoft.com/cdo/configuration/smtpserverport[/URL]") = 25
'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
("[URL]http://schemas.microsoft.com/cdo/configuration/smtpusessl[/URL]") = False
'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
("[URL]http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout[/URL]") = 60
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
objMessage.Send
 
Assuming the code is still good... maybe... and this assumes fixed IP addresses for the two emailing workstations...

Maybe there is an accepted list of known IP addresses allowed to send mail to your remailer/SMTP server. Check with your network engineer who controls the SMTP server to add the new machine's IP addy, or swap the IP addresses of the two machines and see if it works now on the new machine, with the old one's IP address.

Good luck...
 

Users who are viewing this thread

Back
Top Bottom