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!

How to send email programatically?

Status
Not open for further replies.

dsandlin

Programmer
Jul 11, 2003
56
0
0
CR
I have a VFP application that sent me email from my client's site when an error occurred, using Internet Explorer. Apparently, recent security patches have pulled the plug on this functionality, because it has quit working.

I rewrote the function, using FTP to send the message to our FTP site as a file, but now am writing a piece on our end to monitor the site for files and email me the file contents when one appears, using Outlook. That method now pops up the message "Someone is trying to send email from your location, is it okay?", which will not work for an unattended app that runs every 10 minutes (24/7).

I noticed an FAQ about using cdo to send email and I am experimenting with that now, but I worry that it has been thwarted somehow, too.

Does anyone have a way to avoid this security blanket when you have a legitimate reason to send email programatically?

Regards, Dick [wiggle]
 
Look at what I posted in to see a bunch of different ways to email from VFP:

Emailling from within VFP
thread1251-797973

Also, to get around the security patch MS put in Outlook you can use Outlook Redemption, read a little about it and get it from:


boyd.gif

[sub]craig1442@mchsi.com[/sub][sup]
"Whom computers would destroy, they must first drive mad." - Anon​
[/sup]
 
"recent security patches have pulled the plug on this functionality"

Well, you are sort of correct.

Security patches within Microsoft Office have introduced a security screen which asks a user to manually enter an OK or not when a program attempts to send an email.

However there are work-arounds out there.
1. Use Redemption as a "gateway" to Outlook and it will eliminate the problem.
2. Use ClickYes and it should auto-enter the Yes/OK to send the email.
3. Don't use Outlook at all and use something like CDO

If you do a Search of this forum and/or the VFP General Coding forum you should find many previous posting on the topic.

Good Luck,
JRB-Bldr


 
After playing around with the different options for sending email (cdo, automation, MAPI, SMTP) we opted for an approach that sends an XML tagged string as an http POST to a CGI on our server that then uses our SMTP server to reroute the email. Its a little more work but we chose this method as giving us a little more control without relying so much on third party implementations or Microsfot's (now don't laugh) security fixes. If you're interested the heart of the client side code is something like the following:

Code:
loHTTP = CREATEOBJECT("WinHttp.WinHttpRequest.5.1")	
loHTTP.Open("POST", URL, .F.)
loHTTP.SetCredentials(UserName, Password,0)
loHTTP.SetClientCertificate(CertficateName)
loHTTP.SetRequestHeader("content-type", "application/x-[URL unfurl="true"]www-form-urlencoded")[/URL]
loHTTP.SetProxy(ProxySetting, ProxyServer, ByPassList)
loHTTP.Send(vsSendThis)

The CGI end parses the XML email string at the expected tags and sends it.

As I said, a bit more work but at least it gives you another option.

Ralph
 
Thanks for all of your posts. I apologize for being slow in attending your responses, I am distracted by another problem at the moment.

I will try to get back to this later today or tomorrow.

Regards, Dick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top