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

E-mails

Status
Not open for further replies.

progfox

Programmer
Jun 15, 2003
43
IN
Dear Sir,

Well can send mail from our foxpro application. So My question is Can We receive mails in our fox pro application and store say in the text format as a file which will be created automaticaly ASA the mail comes. And the pacth of the file and the attachments will be saved in the database.
For example I have a dbf say mails having structure like this............
slno
from
to
cc
bcc
subject
message(path of the file)
attchment1(path of the file)
attchment2(path of the file)
attchment3(path of the file)
attchment3(path of the file)
read(received or not) logical
replied(replied or not) logical

So can we save the information when a mail come in our derived dbf. If so pls give me your favour.

Regards

Chandan
 
You can grab the email received by most email servers and/or client apps from a VFP application.

There are even email servers written entirely in VFP, but unless you have an existing one, or base it on classes; say
from WestWind; it would be better to depend on an existing
email server as the initial point of reception.

As stated, you can retrieve emails from most email servers/client applications, so I'd look at that first.

Then it's just a matter of transforming the data from the
email server into your VFP database.


Darrell
 
Chandan,

As Darrell says, it is certainly possible to retrieve emails in your app. There are many ways of doing so.

If you could tell us which method you are using to send emails, we can show you how to use the same approach for receiving them.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Well Thanks Darrel & Mike for showing interest in my query.
I am using my outlook to send and receive mails as an application and VPOP3 as server.


if the above informations are sufficient for U then pls show me the proper approach


Regards

Chandan
 
progfox

Take a look at faq184-3808.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I do the same thing at the moment using the MAPIMessages and MAPISession controls, using this instead of the outlook control allows the software to work on the computers in my organisation that have either Outlook or Groupwise installed.

I have a timer that reads through unread emails in the InBox on a reports machine every 5 mins, it reads the emails, runs the reports, stuffs them in a PDF and emails back to source. It also records the body of the email into a memo field in a loging table for later reference.

This should get you started.

oleMAPISession.logonUI = .t.
oleMAPISession.signOn
oleMAPIMessages.sessionID=thisform.oleMAPISession.sessionID
oleMAPIMessages.fetchUnreadOnly = .T.
oleMAPIMessages.fetch

For x = 1 to oleMAPIMessages.msgCount
oleMAPIMessages.msgIndex = 0
' DO YOUR STUFF
ENDDO

thisform.oleMAPISession.signOff

You may need to give some thought to how you will handle the security in recent versions of Oulook, I run it with Outlook97 so its not a problem, but I have seen some posts on here about the issue, so you should be able to find whats required.

Darren

GuiltyMaggot - The best rock band in the world!
 
Chandan,

As you are using Outlook, it is quite easy (note: this refers to the full Outlook, not Outlook Express).

First, get the object references:

oOut = CreateObject("outlook.application")
oNameSpace = THISFORM.oOut.GetNameSpace("MAPI")
oInBox = THISFORM.NameSpace.GetDefaultFolder(6)

oInBox has a collection property called Items, which contains object references to each item in the in-box. So you could display the contents of each message, like so:


WITH oInBox

FOR EACH loM IN .Items
? loM.SenderName
? loM.Subject
? loM.Body
ENDFOR

ENDWITH

Obviously, you could also create a form which displays the same information. You could, for example, put the sender name and subject in a listbox. As the user moves through the listbox, you can display the corresponding body text.

One caveat: Not all in-box items will have exactly the same properties. For example, undeliverables and read receipts do not have a SenderName. Also, I'm not sure if an HTML message has a Body (it might just have an HTMLBody). You might need to check the presence of these properties before referencing them.

Hope this is of some use.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top