Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP & CDO2000 Mystery... aka Need Help

Status
Not open for further replies.

colfrank

Programmer
Jun 26, 2014
9
US
For at least two years (or more) the following code has been running with no problems.
Now it runs, but nothing ever shows up on the target end.
I have transported the code to three different platforms... same results.. no email on the target.
CDO2000 does not return any error codes.... I am at a loss.

loMail = NEWOBJECT("CdO2000", "CdO2000.fxp")
WITH loMail
.cServer = "smtp.gmail.com"
.nServerPort = 465
.lUseSSL = .T.
.nAuthenticate = 1 && cdoBasic
.cUserName = "xyz@gmail.com"
.cPassword = "gh1234"
.cFrom = "Frank"
.cTo = "coljones@abc.net"
.cSubject = "tester"
.cTextBody = "Attached "

* Attachments are optional
ENDWITH


 
Where is the line of code telling to send the generated mail? Let me assume you're just shortening code, as you think it won't help us to see the full code anyway.

Well, the only clue I get from this is you use a class in cdo2000.prg (compiled to cdo2000.fxp) that uses CDO2000, ie CDO.Configuration and CDO.Message - based on CDO2000 being present on the system.

CDO2000 is not a part of VFP and not a part of all OS versions, it may be present together with several software packages but is not guaranteed. Besides, it is, well, 20 years old. Its the modern variant of CDO NTS, but, well, that's even less probable to exist. And just because you don't see any error, I wouldn't bet CDO is still present, the cdo2000 class might just silently log errors instead of popping up a MessageBox.

In short: The solution is not trying to fix this but use any other solution to send emails, there are tons available. One specifically having the least dependencies on OS components was put together on the basis of other partial work on the French FoxAtout and now has its own site:
Bye, Olaf.

Olaf Doschke Software Engineering
 
Frank,
My bet is that is does not 'work' anymore, since you are mailing with Server = "smtp.gmail.com".
Google has changed the rules.
Dont you have a mailbox with an other provider?
Regards,
Koen
 
Colfrank,

I assume you've cross-posted to other forums. It would be great if you could still either post a solution you found to your problem or comment, whether the problem is solved (elsewhere) or remains and what you tried or not.

If you didn't react because nobody mended your CDO code:
It may just be a .Send() missing, the question where you actually make the send call is still open.

Also, without the cdo2000.fxp, it's somewhat guesswork what's kind of object we have at hand here, you set properties about the mail server, that would go into CDO.Configuration and others about the mail itself, that would go into CDO.Message, the mail object. The class you use seems to be an adapter using both CDO.Configuration and CDO.Message, which provides the essential properties of both for you to set.

CDO based solutions are described in the FAQ here and you'll see what I mean:
faq184-1768
and here
faq184-4969

You could do more when you dig into what the underlying OLE classes offer. But there is enough sample code available in the FAWs for what you show you only need. Again, other options are available, like VfpWincok and Blat, which I also already used and recommended in other threads here and elsewhere. But if you insist on CDO you could (re)write a cdo2000.prg to know what's in it with the help of FAQ code and test if that works with simple test mails to mail server credent5ials you know work, so you at least know whether CDO works in principle or is broken for you.

I know VFPWinsock can log very verbose information about the steps it does to connect to the mail server and send mails that's the advantage of a low-level implementation that actually goes as deep as using sockets and implementing the mail protocol. I'm not sure Blat is as verbose as VFPWinsock in logs, but it also makes the whole communication with a mail server you can configure in settings or parameters. Both, also CDO, don't depend on a mail client.

Your real problem could be something else, as Koen already addressed it could be the mail server information for Gmail. It could be too large attachments blocking a mail.
And as you take connecting to the mail server into your own responsibility you'd perhaps be better off making that configurable for users.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top