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!

eMail server that lets you send via CDO

Status
Not open for further replies.

Doug Lindauer

Programmer
Feb 2, 2017
29
0
0
US
I have a problem. :) Why do people always have to make life difficult and change things?

Ok, I have 2 different systems in which I'm using CDO (Thank you Mike Gagnon to send emails. I HAVE been using free accounts in gmail to send them BUT gmail is now, as of today, 5/31/2022, terminating the ability to send emails from "less secure apps", whatever that means. They don't explain so I don't know if there's any way I could make my systems "more secure".

So I've been looking around, a little unsuccessfully, for some other free email service that lets you send stuff via SMTP using CDO. I don't know any other way to send from within VFP. My two systems both need the ability to send attachments. One of them may have 5-10 small attachments to include, usually 1 page PDF's. The systems generate the TO, CC, BCC, Subject, and body and I create a review screen that lets them check out the email before clicking a "Send" button.

At any rate does anyone know of other free email services which I can use? Free is preferred because then I don't have to tell the clients they have to start paying for something I (unwisely?) told them was free. :) I'm hampered a little because I work from home which is up in the E. Tennessee mountains and I don't have cell service, only landline. The ones I've looked at, like AOL, want to send me a text message to set up an account. Well that's a non-starter! Yes I can get someone who lives in town to do the setup but that's a lot of extra bother and who knows if I'll have to do it several times before I find a service that will work.

So what have other people found that works? I COULD write a new module which uses MAPI or something if there's a MAPI For Dummies link like the Mike Gagnon thing. I know squat about things outside of the database world.
 
Hello Doug. Welcome back.

First question: do your clients have their own domain name (perhaps for hosting their website)? If so, the chances are that their service provider will include a number of email addresses within their hosting plan. I expect you have already considered this option, but I thought I would mention it anyway.

Regarding free email services, you might look at GMX ( I've used it occasionally when I've wanted a throw-away email address. I've only ever used it interactively, but I see no reason for it not to work with CDO.

One other thought. Have you considered using Outlook Automation with GMail, instead of CDO? That approach has pros and cons, the chief con being that your clients will need to have Outlook installed. But if that's not a problem, you might find that it's the best solution. If necessary, I could give you more details of how to do it (as could many of the other regulars here).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
You could set up an HMail server of your own to send your files, or mailenable, or one of the many other smtp servers.



Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0
 
Mike, both of the clients have a website but their webhost services don't provide POP access. They want you to use their web interface to do email. But both clients do have Outlook 2010 installed. I don't really know anything about using Outlook automation but that sounds like a more complicated option than just finding a new server and keeping all my existing code. But I'm up for giving it a go if I can't find something easier. I'll look around to see if I can find something that explains how to do it. Tamar has a book written 22 years ago on doing office automation in VFP. I wonder if the info is still usable? If so I'll get a copy of the book on Amazon. It's out of print but there are used copies around.

I tried GMX. It didn't work. There is a note that if you use TLS it has to be v1.2 or 1.3. When I tried sending with sendtls set to true, it gave an error saying authentication required. I don't know what's built into CDO. Seems like it must be an older TLS.

Griff: I might like to give Hmailserver a go. But don't you have to have some kind of internet domain name first? I've looked at it and installed it but I'm completely lost. To use CDO, it wants to connect to the name of a mail server. That name should get resolved by a DNS server back to an IP address. So I don't have a clue as to how hmailserver is supposed to work.
 
Doug,

Just to give you a quick flavour of how to use Outlook ...

This code is not meant to be run as is. It's just to give you the general idea of what's involved.

Code:
* MailDem. Quick demo of sending messages via Outlook.

oOut = CREATEOBJECT("outlook.application")
oMail = oOut.CreateItem(0)

* Set up the message
oMail.subject = "Notice of AGM"
oMail.to = "mlewis@example.com"
oMail.Body = "Dear Members, just a reminder that our AGM will be on Wednesday evening."
	&& The above is plain text; you can also do HTML, in oMail.HTMLBody.
    && You can also create a message based on a template.
    
* Add BCC recipients
oRecip1 = oMail.recipients.Add("xyz@somewhere")
oRecip2 = oMail.recipients.Add("mike12345e@gmail.com")
oRecip1.Type = 3	&& 3 is BCC
oRecip2.Type = 3    
	&& you can aslo concanenate the recipients in a comma-delimited list
	&& and put them straight into the TO, CC or BCC property
	
* You can also add attachments
	
oMail.Display	&& open in editing window, after which user can send

* oMail.Save	&& OR save to Drafts folder, after which user can open 
				&& to preview, edit and send
				
* oMail.Send	&& OR send immediately without preview or user editing

You mentioned Tamar's book on Office Automation. I'm pretty sure that the information in it would still be relevant (Tamar visits here occasionally, so she might confirm that). If you can't find a physical copy of the book, you might check the Hentzenwerk site to see if they do a PDF version.

There are also lots of articles on line about Office Automation. Both Tamar and Doug Hennig have collections on line, which might be a good place to start( and
Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Yes, almost everything in the Automation book still works. For Outlook, you need to be working with a locally installed version, of course.

Tamar
 
Hi,

This is what I found on foxite.com:

“Please take a look at
The idea here is to turn on 2-step verification and then create an application password. In this option you can name the device from which you are going to send emails from that account and CDO2000 will continue to work.”

I’ve tried this with on of our Gmail accounts and it’s working as far as I can see.
Time will tell if this is the ultimate solution.

Regards, Gerrit
 
Ok, to all, much thanks. Gerrit, yes, that does work so my problem is solved without any change to code. I have a SENDMAIL table in both systems so all I have to do is update the data and voila. My kind of simple. For anyone who follows this thread with the same problem, the steps to turn on the app password are at
I'm going to consider this to be a temporary fix and I think I'll order Tamar's book and get educated on office automation. It will probably come in handy elsewhere. The hmailserver thing is pretty good too if I can figure out how to make it work. In theory I would think that I don't need DNS to resolve an IP if I put something like the loopback address in instead of a URL. But that didn't work for me. Maybe it's a firewall problem. Oh well. There's never anything simple in this business.
 
Doug, I'm very pleased that the problem is solved. After I posted my suggestion re Outlook Automation, it occurred to me that it might not have worked with Gmail, for the same reason that your existing solution didn't work. I was about to suggest that you check that before you invest too much time in learning about Automation. But Gerrit's suggestion should solve that problem.

That said, email apart, it is definitely worth getting to grips with Automation in general. It will help you to do all kinds of things that you could not do natively in VFP. So go ahead and get the book, and come back here with any specific questions you might have.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top