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

DOWNLOAD SMTP MAIL VFP 9

Status
Not open for further replies.

WIREMESH

Programmer
Mar 15, 2004
109
US
I need a simple way to connect to a google email account I create and download all new mail messages. Once the mail messages are downloaded, I want to delete them from Google.
 
wiremesh

Is this a business real world requirement? You have a client that uses Google e-mail account?


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
This is a real world app. I have an application that sends messages to clients. For each client, i have setup a google email address used to handle responses.

 
I have done this natively with VFP using the winsock interface, but I remember it was wholly unsatisfactory.

If I was doing it now, I wouldn't hesitate to use the WestWind IP components - no question that they would do the job.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
It's perfectly possible to read Google mail via POP3. You can then use any of the usual methods of accessing POP3 from within VFP. For example, you could use Outlook Automation to retrieve the messages.

For information about reading GMail via POP3, see:

For information about accessing a POP3 mailbox via Outlook, browse the FAQs in this forum, or do a quick search. There are dozens of articles about it floating around.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
I have put a copy of the, rather rubbish, VFP6 project that I was tinkering with to do this very thing.

If you want to download it and look at the code etc please feel free.


I gave up on it in 2003!

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
I see 2 tools that should accomplish this.

something from Chilkat and the Rick Strahl client tools. There is some code in Rick strahls library that looks like this:

loPop = CREATEOBJECT("wwPop3")
loPop.cMailServer = lcMailServer
loPop.cUserName = lcUserName
loPop.cPassword = lcPassword
lopop.lLogSession = .F.

*** Connect to the server with username password and retrieve message count
IF !loPOP.Connect()
loProcess.Errormsg("Couldn't connect to mail server",loPop.cErrormsg)
RETURN
ENDIF

IF EMPTY(lcId)
*** Display a message list
IF loPop.nMessageCount > 0
CREATE CURSOR TMessages (Date C(20),From C(80),Subject M,Size C(15),Action M)
FOR m.x =1 TO loPop.nMessageCount
loMsg = loPop.GetMessageHeader(m.x)
INSERT INTO TMessages(Date,From,Subject,Size,Action) VALUES ;
(TIMETOC(loMsg.dDate),loMsg.cFromName, loMsg.cSubject , TRANS(loMsg.nSize/1000,"999,999,999kb"),;
[<a href="WebMail.wwd?MsgID=] + UrlEncode(loMsg.cMsgId) + [">View</a> | ] + ;
[<a href="WebMail.wwd?MsgID=] + UrlEncode(loMsg.cMsgId) + [&Action=Delete">Delete</a>] )
ENDFOR
INDEX ON Date DESCENDING TAG Date

loSC = CREATEOBJECT("wwShowCursor")
loSC.lAlternateRows = .T.
loSc.nPage_ItemsPerPage = 20
loSc.cExtraTableTags = [style="font:8pt Verdana"]
loSC.ShowCursor()
lcOutput = loSC.Getoutput()
ELSE
lcOutput = "<p><center><h3>No Messages in your mailbox</h3></center><p>"
ENDIF
 
Ricks Strahl is WestWind.

I think you have to buy the software, but it is pretty darn good

Regards

Griff
Keep [Smile]ing

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

it's true, that SENDING mails is discussed in detail and with lots of options, RECEIVING mails is a rather seldom need.

In addition to your findings, MAPI in general is a solution for working with the different folders including the inbox, not only via Outlook. As you talk of a win2008 server I assume there is no mail client installed whatsoever, it would still make sense to do so in my oppinion, as there is a lot of different features to support, if doing that on your own, not only regarding attachments, but also encodings, signatures and other mime sepcialties, not to talk about spam.

So simply for security reasons it would make sense to use some standard to receive the mail. Optimal would perhaps be to work on the Server Hosting Exchange or Tobit David or other groupware mail solutions - even if you just want to receive mails for one account and even, if only selected mails with certain predetermined mail subjects are loaded.

Bye, Olaf.
 
I have an application that sends messages to clients

Sending the email messages to clients is not too difficult.
It has been discussed many times on this forum.
A Search of the forum will turn up quite a few of those postings.

But the Downloading of email messages in the absence of Outlook as a recipient client is a very different matter.

Far be it for me to question what you or your client's want an application to do, but sometimes asking more questions helps us to focus on answers which best meet your needs (not always the same as what is asked for).

download all new mail messages. Once the mail messages are downloaded, I want to delete them from Google.

My question would be - What are you going to Download the email messages into in the absence of Outlook (or any other email client software) on the execution machine?

And if you get them downloaded, how are you going to display them to the appropriate individuals?

Are you trying to make VFP work as an an automated Email Client in lieu of Outlook (or any other email client software)?

At first glance - I'd suggest that, to make your development life a WHOLE LOT EASIER, you could set up a workstation (physical or virtual) that does indeed have Outlook on it and use it as your VFP Application 'Server' on which to run the VFP application. Then you could do everything through VFP automation of Outlook.

Good Luck,
JRB-Bldr
 
Olaf and JRB,

I *think* WIREMESH is saying that he has an application installed on his client's servers that he periodically needs to communicate with via email - perhaps he is sending text updates or some such - and while he can update his application, he cannot install any other software on the remote server or be sure that there is any email client at all, or if there is have any control over it.

If he can modify his application to read the mail, and then delete it, from google mail or whatever - any POP3 mailbox would do presumably - he won't need to install anything else, he might not even have to have a conversation with his client's IT - which would doubtless be prolonged and often fruitless B-)

Personally, I would use Rick Strahl's WestWind stuff, having tried to code with winsock and been very frustrated - but maybe he can't spend any money.

Good luck to him.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Thanks for the responses. I have an application that sends emails to field techs from potentially hundreds of customers. The field techs are required to reply to the email I send them from my vfp app. I decided to setup a separate email account for each client. I read the client email account (gmail), download the emails, and make updates in a database application. Once the records are updated in the database I will purge the email. In most cases, they will respond with simple text (i.e "be there in 20 minutes").

At some point I may setup a mail server, but for now, I need to demonstrate this asap and I figured gmail or hotmail would be the easiest method. I really don't care if it is gamil, as long as the account is free and easy to access.
 
I am pretty sure that the West-Wind products support ssl (I use them for https - is that the same thing?).

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Rick Strahl informed me the wwpop library does not support ssl.

I think I just may install outlook on the server I parse my emails from outlook.
 
Since I don't know what your server was installed to run, I can't say for sure, but as I suggested above, I'd recommend setting up a separate workstation (physical or virtual) to run your VFP application and have Outlook installed there.

In that way it would become your VFP Application 'server' (or a pseuod-server) and its associated files, etc. would be separate from whatever the real server was installed to do.

One of my clients has a similar setup where there are 2 separate dedicated VFP Application 'servers' (one physical workstation and one virtual workstation) - each running their own applications. They both have Outlook on them and each use VFP automation to Send their associated emails (about 200+ each per day) just fine.
Unfortunately those applications do not Receive emails so I can't help you much with that side of things.

One note about using Outlook in an automated manner - periodically check the size of your Outlook PST file to ensure that it doesn't get too big.
With automation running Outlook this can be easily overlooked.

You might want to periodically exchange the PST file with a new 'virgin' one (this is what my client does) or you can Archive off emails and then Compact the file.

Good Luck,
JRB-Bldr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top