Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Moose Taylor
  Where is Moose Taylor?
 Oxford
 United Kingdom
 Moose Taylor
 To: Ronald de Jesus
  Where is Ronald de Jesus?
 Los Baños
 Philippines
 Ronald de Jesus
 Tags
Subject: RE: Foxpro calling Outlook XP on WinXP
Thread ID: 33704 Message ID: 33861 # Views: 2 # Ratings: 0
Version: Unknown Category: Microsoft Office Automation
Date: Thursday, December 04, 2003 3:01:24 PM         
   


Yes, you can use it to check an Exchange server or whatever for POP3 messages.

Here's some code I knocked up for checking mailboxes ...Have fun!

John Taylor MCP
(You can't polish a turd)

*******************************************
** Program Name : mailbox_scan
** Created by : JohnT
** Create date : Friday, 16th August 2002 17:09:12
** PRG Overview / Description : Scans a users mailbox and build a cursor of messages.
**
**
** Variables Used:
** 1) pcUser The user's mailbox you want to scan, i.e. mine is "broadsystem\johnt\john.taylor"
** 2) pcPassword Their password, i.e. mine is ************ (d'you think I'm stupid!)
** 3) liMessages The number of messages to scan, if -1 then all messages.
** (messages are scanned in reverse, i.e. most recent first)
**
** Output:
** 1) A cursor called mailbox
**
** DLLs / Classes Used:
** 1) JMail
**
** Example calling string to scan the most recent 20 messages...
** mailbox_scan("broadsystem\johnt\john.taylor", "****", 20)
****************************************************
****************************************************
Lparameters pcUser,pcPassword,liMessages,llSaveAttachments

#Define vfpCRLF Chr(13)+Chr(10)

local lcMailServer
lcMailServer = "yourMailServerName"



* Attachment Save directory
If llSaveAttachments = .T.
lcAttachmentDir = Addbs(Sys(5)+Curdir())
Endif

loMsg = .Null.
loPop3 = .Null.
loPop3 = Createobject( "JMail.Pop3" )
loPop3.Connect(pcUser, pcPassword, lcMailServer)

Clear
? pcUser+[: You have ] + Alltrim(Str(loPop3.Count)) + [ emails in your mailbox]

liCnt = loPop3.Count
If loPop3.Count > 0 then

* Work out how many messages to scan
liTarget = 0
If liMessages = -1 then
liTarget = 1
Else
liTarget = (liCnt - liMessages) + 1
Endif


* Create the mailbox cursor
Create Cursor mailbox (;
msg_id Int,;
subject Char(60),;
from_name Char(80),;
to_name Memo,;
header Memo,;
body Memo,;
HTMLbody Memo,;
Attached Memo,;
msg_type Chr(20),;
sentdate Char(30))

loMsg = loPop3.Messages

* Scan messages
Select mailbox
For i = liCnt To liTarget Step -1
Append Blank

**************************************
* Check for attachments
**************************************
lcAttach = ""
attachCnt = loMsg.Item(i).attachments.Count
For attachNo = 1 To attachCnt
Attachment = loMsg.Item(i).attachments.Item(attachNo - 1)
lcAttach = lcAttach + Attachment.Name + vfpCRLF
If llSaveAttachments = .T.
If Not File(lcAttachmentDir+Attachment.Name)
Attachment.SaveToFile(lcAttachmentDir+Attachment.Name)
Endif
Endif
Endfor

Replace ;
msg_id With i,;
subject With loMsg.Item(i).subject,;
from_name With loMsg.Item(i).From,;
to_name With loMsg.Item(i).RecipientsString,;
header With loMsg.Item(i).Headers.Text,;
body With loMsg.Item(i).body,;
HTMLbody With loMsg.Item(i).HTMLbody,;
Attached With lcAttach,;
msg_type With loMsg.Item(i).ContentType,;
sentdate With nicedate(loMsg.Item(i).Date)
Next i
Endif

loPop3.Disconnect
loPop3 = .Null.
loMsg = .Null.
Attachment = .Null.
Return .T.

ENTIRE THREAD

Foxpro calling Outlook XP on WinXP Posted by Allan Sabo @ 12/2/2003 5:54:36 AM
RE: Foxpro calling Outlook XP on WinXP Posted by Moose Taylor @ 12/2/2003 4:18:44 PM
RE: Foxpro calling Outlook XP on WinXP Posted by Ronald de Jesus @ 12/4/2003 11:36:10 AM
RE: Foxpro calling Outlook XP on WinXP Posted by Moose Taylor @ 12/4/2003 3:01:24 PM
RE: Foxpro calling Outlook XP on WinXP Posted by Ronald de Jesus @ 12/5/2003 1:17:15 AM
RE: Foxpro calling Outlook XP on WinXP Posted by Moose Taylor @ 12/5/2003 3:55:36 PM