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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sending emails from vfp appication

Status
Not open for further replies.

T883

Programmer
Nov 2, 2016
7
0
0
US
I've been sending emails with pdf's attached for over 3 years using gmail - till last week they just stopped working. After researching other people's comments I switched to Yahoo email and it worked for 2 days and now it no longer works. I've been using the "cdo2000" code for years. Is there another or better way?? This is basically my current program: I keep getting error 1429 along with either 187 or 191

thanks for any help and/or guidance!

Code:
FUNCTION send_email
loMail = NEWOBJECT("Cdo2000", "Cdo2000.fxp")
WITH loMail
   .nServerPort	= 465
   .lUseSSL	= .T.
   .nAuthenticate	= 1

   .cServer   = "smtp.mail.yahoo.com"
   .cUserName = "username@yahoo.com"
   .cPassword = "17digitpassword"
   .cFrom     = "username@yahoo.com"
   .cTo       = "recipient@whatever.com" 
   .cSubject  = "statement"
   .cAttachment = SYS(5)+CURDIR()+'pdfs\'+ALLTRIM(pdf_name)
ENDWITH

IF loMail.Send() > 0
  FOR i=1 TO loMail.GetErrorCount()
          ? i, loMail.Geterror(i)
  ENDFOR
ENDIF
  loMail.ClearErrors()
RETURN
 
Could it be they, Gmail and now Yahoo, think you are sending spam and are blacklisting you?

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.
 
By the way, Gmail stops suddenly sending emails from applications or IP cameras etc. because they have a new security option implemented some time ago. In gmail settings you can allow less secure apps sending mails. Perhaps that is your solution sending mails using Gmail. It worked for my Cameras and my applications that send mails automatically.
 
I already changed the option in Yahoo to allow less secure apps - and it worked briefly but now it does not.
About gmail and/or yahoo blocking spam - is there a way to find out? We routinely send emails to customers and vendors so this is becoming a real problem. At this point the only option is to send each one manually (up to 75 per day) or print hard copies and use snail mail. Neither of these is a desirable option.
 
Given that this is a commercial application, involving customers and vendors, and with non-trivial volumes, I'm surprised you chose to use free web-based mail services like Gmail and Yahoo.

Is there any reason why you can't either host the emails yourself, or use a third-party hosting company, using POP3 and/or SMTP? That way, you would have much more control over blocking, spam settings, etc.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
This is a very small company we do not have a true server/client set up. We simply use one pc as the 'main' drive with a couple other pc's as workstations using shared mapped drives. Don't we need to have our own domain to self-host? I keep thinking that something about the smtp process has changed recently, since gmail has been working just fine until last week. Also, we are only sending emails from vfp - we don't need to receive anything in the program.

I'm not sure how to go about using a third-party host. Do you mean something like outlook, mailjet, zoho etc? I've been researching alternatives but not sure if these will work with similar smtp code.
 
I use BLAT to send hundreds of confirmations mails every day.
You just need a valid SMTP-server...
 
This is a very small company we do not have a true server/client set up. We simply use one pc as the 'main' drive with a couple other pc's as workstations using shared mapped drives. Don't we need to have our own domain to self-host?

You don't need to run your own server. For a small business, the easiest approach is to use a hosting company. That's what we do in my own (very small) company. We registered a domain name, which is trivially easy and costs almost nothing. We use one of the many hosting companies to actually host our email (and website). It costs only a few GBPs per month.

Once you've done that, you can send and receive emails either through the hosting company's own web-based mail system, or using any email client (Outlook, Thunderbird, Microsoft Mail, etc.) on your own PC. To send emails from your VFP app, you can either automate Outlook, or you can use a tool like Blat, or you can continue with your present approach of using CDO.

If you only want to send emails (never receive them), you probably don't even need to go that far. The chances are that your ISP provides outgoing SMTP mail as part of its package. If so, you can use the same code that you posted above, but change the SMTP server details to those of the ISP.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Error 1429 is general error number for any OLE error VFP has become forwarded. In your case most probably coming from whatever CDO class cdo2000.fxp uses. The code of cdo2000.prg would be much more helpful to see what you're using, and error messages would also be much more helpful to see what's going on. Especially the classes Geterror method might translate the numbers 178/191, if it's not line numbers. You have just posted the usage of a user-defined class, the user defined class code itself will surely tell more about the nature of the error, eg it might be rejected login, hitting rate limits...

I don't know, but 187/191 rather seem to be the line numbers of errors happening in the prg/fxp, than being OLE error numbers. Those are typically mentioned hexadecimal in the range 0x80000000 and higher (or lower), decimally because of sign bit that means large negative numbers in the region -2147483647.

I can only second Mikes advice on using your ISPs mail server with your mail account there or buy a domain for you company, even a single freelancer can afford those rates.

Bye, Olaf.
 
This is a very small company we do not have a true server/client set up
Even small companies have Business Expenses.
And if this is a Business CRITICAL operation then doing it in a 'professional' manner is essential.

There are a lot of 3rd Party Email Servers out there that you can hire.
One way is to do a Google Search for: email servers or hire email servers or 3rd party email servers

You just need to decide, in addition to needing SMTP service for Sending, if you want POP or IMAP for Receiving.

Good Luck,
JRB-Bldr
 
I have just been looking back as some code I wrote for a client a few years ago.

They were also a small business, and they also wanted to email out their invoices - in their case, about 500 per month. I wrote some code similar to that posted by T883 at the start of this thread. It was loosely based on Mike Gagnon's FAQ: faq184-4969.

The application was only concerned with sending out mail, not receiving it. I found the address of their SMTP server from their ISP (which I think was British Telecom or something similar). I didn't need to code a user ID or password. I don't remember exactly why. I think it was something to do with the fact that the client had already configured Outlook (or it might have been Outlook Express) to send email via SMTP, so the PCs already "knew" the log-in details. (Not sure about that.)

In this case, the client didn't need to go with a third-party email-hosting service, and they certainly didn't need to set up their own email server. That was because the app was only concerned with sending, not receiving. They used their normal email address as the From and Reply To addresses, so they received email in the normal way (via Outlook or whatever).

That sounds like a similar scenario to the one under discussion. I hope this demonstrates how easy it is to not have to reply on Gmail or Yahoo.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Just to add to JRB's good advice:

Does your company have a website? If so, check with the company that hosts it. There's a good chance that they offer email hosting as part of their package. You might even already be paying for it, so you might as well use it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
To all participants in this discussion,

I have been experimenting with an Email server of my own. It works properly, both to send and receive just fine. But while sending test Emails to one of my friends, suddenly Google denied to deliver my posts to that account. It blocked my posts and will no longer pass them along to that account. What triggered it? I was sending the same post for more than 5 times and Google decided that I am a spammer.

So, who do we talk to, to get this big brother domination operation to relax?

Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
you said >I have been experimenting with an Email server of my own...suddenly Google denied to deliver my posts to that account

What has google got to do with it? Are you using googles mail server (while you said you experiment with your own mailserver)? Is the recipient a google mail address? Sending same mails over again you can be blacklisted very fast. Don't ask me, what exactly triggers it.

Bye, Olaf.
 
I have been experimenting with an Email server of my own.
That means that you are NOT USING GOOGLE.

But then you go on to talk about what Google is doing.

So either you are using "one of your own" OR you are using "Google's"

If Google's, then you need to follow our suggestions above about getting away from Google.

Good Luck,
JRB-Bldr



 
I agree with the two previous posts. It would be helpful if you could tell us exactly what point you have now reached. Are you still using Gmail? Or Yahoo? Or your own mail server (that is, a machine physically installed on your network)? Or a third-party hosting company? Or none of the above?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Guys, guys....

One of my close friends has a google account "xxxxx.gmail.com". So, I sent more than 5 repeat Emails to his Gmail account, from my own hosted Email account... from a major Hosting outfit, let's say GoDaddy.com.

And now I cannot send any emails to that account, any more from my Email account, the one I used to send him Emails in the past 10 years... Does that clear things up?

Who else would be responsible for that if not Google?


Cheers!


Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
>Is the recipient a google mail address?
Ýou indirectly answered that with yes. Makes me wonder how 5 repeat mails do so, that would be a very strict limit for blacklisting.

>from my own hosted Email account
You don't say from my own mail server. So now the only thing you may still do wrong is using gmails mailserver, because the recipient is a gmail account.
Call me annoying, but be clear about it, I see people do such things. And mail servers react with blacklisting of a wrong sender mail address.

Bye, Olaf.
 
Olaf,

You are going to make me think while I am typing. I may be too old for that... my friend. [bigsmile]

Okay, Sorry... For the "Return address" I used an address from an existing account on my Hosted account DennisTheOldOne@HostedAccount.com. Maybe that I should not refer to what I have confabulated as an Email server. The Berezniker GetEmail function picks up the Email from My host just one of my Email accounts. So, I am not using an MS Exchange server which hosts Email and what not. However, I dared to call my confabulation as an EMAIL SERVER. Ha ha ha... But it sure works like one! So for the purpose of concluding that Google is responsible for doing this, I was bold enough to announce my experience. And yes it took 5 emails, maybe 10 at the most, just to be safe.

Cheers....



Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top