N
Neil
I have been using CDO with Access for years to send e-mail messages, as many
of you have, as well. I've never had a problem with it. I currently have a
problem with one of my clients, and am in the middle of a pissing contest
with his IT guy. Any help or insight would be appreciated. Here are the
facts.
1) Sent client a standalone MDB file called "CDO Test.mdb" that had a module
with a single routine to send a CDO test message, and a macro to execute the
code. Client ran it, and it sent the message to me at my gmail account fine.
This was in June.
2) Implemented CDO code into the application, but client didn't test until
now. Message wasn't sent when he used it. So I had to him use the CDO
Test.mdb file from June, which had previously worked. He used it to send me
a message. Didn't get an error message. But message wasn't sent to me
either.
3) In comes IT guy. He doesn't know what the problem is, isn't familiar with
CDO. But when he does some testing, he finds that he can use CDO Test.mdb to
send a message within the company's own domain, but not to an outside
domain. Also he finds that if he changes the parameters in CDO Test.mdb to
connect to his Verizon.net e-mail server, instead of the company's Exchange
Server, and tries sending it to another domain, he gets the following
message back from Verizon: "Your message cannot be delivered to the
following recipients:... Reason: Illegal host/domain name found." But when
he does the same thing to connect to his Verizon.net e-mail server and send
to another Verizon.net address, it goes through fine.
So both from and to his company's domain using the company's e-mail server
work. And both from and to Verizon.net using Verizon's e-mail server work.
But trying to send to an outside domain in both cases fail. Same with Gmail.
But all of these were done from within the company, using the company's
Internet connection (though not the exchange server, apparently - unless the
Exchange server still comes into play when sending mail to Verizon's e-mail
server).
4) At the same time, and using the same code, I can connect to my Gmail
account and use the Gmail mail server to send mail to a different domain to
his address at the company's domain. And, again, the client used the exact
same code several months ago to send mail from his company's mail server to
my Gmail account.
So I'm stumped. The code hasn't changed. And there's no reason for it to
work, but not be able to send to a different domain. And, as noted, it works
for me to send to a different domain, but not them.
At first I thought it was something with their Exchange server. But since
it's the same if he uses the Verizon or Gmail mail server, that wouldn't be
the case. Unless someone Exchange is still coming into the picture, even
when sending through an outside mail server?
Anyway, any ideas would be appreciated. Code is below.
Thanks,
Neil
Const cUsername = "(e-mail address removed)"
Const cPassword = "somepw"
Const cMailServer = "smtp.gmail.com"
Const cPort = 465
Const cUseSSL As Boolean = True
Const cTo = (e-mail address removed)
Const cFrom = "(e-mail address removed)"
Dim iMsg As New CDO.Message
Dim strTo As String
Dim fAttach As Boolean
Dim strAttachment As String
With iMsg
With .Configuration.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = cMailServer
.Item(cdoSMTPAuthenticate) = cdoBasic
.Item(cdoSendUserName) = cUsername
.Item(cdoSendPassword) = cPassword
.Item(cdoSMTPServerPort) = cPort
.Item(cdoSMTPUseSSL) = cUseSSL
.Item(cdoSMTPConnectionTimeout) = 10
.Update
End With
.To = cTo
.From = cFrom
.Subject = "CDO Test - " & Now()
.TextBody = "This is a test from CDO."
.Send
MsgBox "Sent.", vbInformation
End With
of you have, as well. I've never had a problem with it. I currently have a
problem with one of my clients, and am in the middle of a pissing contest
with his IT guy. Any help or insight would be appreciated. Here are the
facts.
1) Sent client a standalone MDB file called "CDO Test.mdb" that had a module
with a single routine to send a CDO test message, and a macro to execute the
code. Client ran it, and it sent the message to me at my gmail account fine.
This was in June.
2) Implemented CDO code into the application, but client didn't test until
now. Message wasn't sent when he used it. So I had to him use the CDO
Test.mdb file from June, which had previously worked. He used it to send me
a message. Didn't get an error message. But message wasn't sent to me
either.
3) In comes IT guy. He doesn't know what the problem is, isn't familiar with
CDO. But when he does some testing, he finds that he can use CDO Test.mdb to
send a message within the company's own domain, but not to an outside
domain. Also he finds that if he changes the parameters in CDO Test.mdb to
connect to his Verizon.net e-mail server, instead of the company's Exchange
Server, and tries sending it to another domain, he gets the following
message back from Verizon: "Your message cannot be delivered to the
following recipients:... Reason: Illegal host/domain name found." But when
he does the same thing to connect to his Verizon.net e-mail server and send
to another Verizon.net address, it goes through fine.
So both from and to his company's domain using the company's e-mail server
work. And both from and to Verizon.net using Verizon's e-mail server work.
But trying to send to an outside domain in both cases fail. Same with Gmail.
But all of these were done from within the company, using the company's
Internet connection (though not the exchange server, apparently - unless the
Exchange server still comes into play when sending mail to Verizon's e-mail
server).
4) At the same time, and using the same code, I can connect to my Gmail
account and use the Gmail mail server to send mail to a different domain to
his address at the company's domain. And, again, the client used the exact
same code several months ago to send mail from his company's mail server to
my Gmail account.
So I'm stumped. The code hasn't changed. And there's no reason for it to
work, but not be able to send to a different domain. And, as noted, it works
for me to send to a different domain, but not them.
At first I thought it was something with their Exchange server. But since
it's the same if he uses the Verizon or Gmail mail server, that wouldn't be
the case. Unless someone Exchange is still coming into the picture, even
when sending through an outside mail server?
Anyway, any ideas would be appreciated. Code is below.
Thanks,
Neil
Const cUsername = "(e-mail address removed)"
Const cPassword = "somepw"
Const cMailServer = "smtp.gmail.com"
Const cPort = 465
Const cUseSSL As Boolean = True
Const cTo = (e-mail address removed)
Const cFrom = "(e-mail address removed)"
Dim iMsg As New CDO.Message
Dim strTo As String
Dim fAttach As Boolean
Dim strAttachment As String
With iMsg
With .Configuration.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = cMailServer
.Item(cdoSMTPAuthenticate) = cdoBasic
.Item(cdoSendUserName) = cUsername
.Item(cdoSendPassword) = cPassword
.Item(cdoSMTPServerPort) = cPort
.Item(cdoSMTPUseSSL) = cUseSSL
.Item(cdoSMTPConnectionTimeout) = 10
.Update
End With
.To = cTo
.From = cFrom
.Subject = "CDO Test - " & Now()
.TextBody = "This is a test from CDO."
.Send
MsgBox "Sent.", vbInformation
End With