Hi Derek
Here's a routine I used to read thorugh the inbox & process the attached text files to read in the data into a table.
Not exactly what you're after, but this should take you some of the way. I've used Redemption to sendf emails, but just reading thorugh the inbox doesn't seem to need Redemption, as it doesn't seem to create any secuirity messages from Outlook.
Hope this helps
Rob
SET DATE BRITISH
SET EXCLUSIVE OFF
SET DELETED ON
SET talk OFF
SET SAFETY off
mhome="C:\FRANCHISE\SAVEDATTACHMENTS\"
CLOSE DATABASES ALL
IF !USED("FRANCHISE")
USE franchise IN 0
ENDIF
IF !USED("ENQUIRIES")
USE enquiries IN 0
ENDIF
IF !USED("NEXITID")
USE nextid IN 0
ENDIF
IF !USED("sourceofenquiry")
USE sourceofenquiry IN 0
ENDIF
SELECT 0
#DEFINE olFolderInBox 6
Local lcFilename,lcPath
lcPath='c:\franchise\savedattachments\'
If !Directory('c:\franchise\savedAttachments')
Md 'c:\franchise\savedAttachments'
Endif
oOutLookObject = Createobject('Outlook.Application')
olNameSpace = oOutLookObject.GetNameSpace('MAPI')
myAtts=olNameSpace.GetDefaultFolder(olFolderInbox).Items
mdir=curdir()
DO FORM forms\progress NAME FRMPROGRESS LINKED WITH "Looking for new enquiries in Microsoft Outlook..."
SET DEFAULT TO &mdir
PUBLIC ofrmprogress
ofrmprogress=frmprogress
mno=0
USE jobtypes2 IN 0
For Each loItem In myAtts
mno=mno+1
oFrmProgress.opb.ctlvalue=mno/myatts.count*100
ofrmprogress.opb.refresh()
IF LEFT(loitem.subject,19)<>"New Enquiry" OR loItem.attachments.Count=0
loop
ENDIF
For i = 1 To loItem.attachments.Count
lcFilename=''
lcFilename = loItem.attachments.Item(i).filename
IF lcfilename<>"info.txt"
LOOP
ENDIF
lcFilename2 = Alltrim(lcPath)+SYS(3)+".txt"
loItem.attachments.Item(i).SaveAsFile(lcFilename2)
loItem.attachments(i).delete()
EXIT
next
NEXT
mno=0
ofrmprogress.caption="Processing emails..."
mf=mhome+SYS(2000,mhome+"*.txt")
DO WHILE !UPPER(mf)==mhome AND LEN(ALLTRIM(mf))<>0
io=FOPEN(mf,0)
STORE FSEEK(io, 0, 2) TO gnEnd
STORE FSEEK(io, 0) TO gnTop
ml=FGETS(io,255)
IF LEFT(ml,11)<>"Version:1.0"
=FCLOSE(io)
DELETE FILE (mf)
mf=mhome+SYS(2000,mhome+"*.txt",1)
loop
ENDIF
ml=FGETS(io,255)
IF LEN(TRIM(ml))=0
=FCLOSE(io)
DELETE FILE (mf)
mf=mhome+SYS(2000,mhome+"*.txt")
loop
ENDIF
mtitle=pip(1,ml)
mdate=CTOD(pip(2,ml))
msurname=pip(3,ml)
mfirstname=pip(4,ml)
mpostcode=pip(5,ml)
mstreet=pip(6,ml)
madd1=pip(7,ml)
madd2=pip(8,ml)
madd3=pip(9,ml)
madd4=pip(10,ml)
mtel=pip(12,ml)
mdaytel=pip(11,ml)
mmobno=pip(13,ml)
mtakenby=pip(14,ml)
msource=pip(15,ml)
mleaflet=pip(16,ml)
mhoenqno=PADL(ALLTRIM(pip(17,ml)),8,"0")
memailaddress=pip(18,ml)
mcomments=pip(19,ml)
IF !SEEK(mhoenqno,"enquiries","ihoenqno")
menqno=bsnextno("ENQUIRY")
insert INTO enquiries (ctitle,cfirstname,clastname,cstreet,caddress1,caddress2,caddress3,caddress4,cpostcode,ctelno,daytel,cmobno,ctakenby,csource,leafletref,ihoenqno,cemail,ienquiryno,lspecialprice,auto,cdirections,ddate) VALUES ;
(mtitle,mfirstname,msurname,mstreet,madd1,madd2,madd3,madd4,mpostcode,mtel,mdaytel,mmobno,mtakenby,msource,mleaflet,mhoenqno,memailaddress,menqno,!franchise.lautoprice,.t.,mcomments,mdate)
INSERT INTO customerlog (ddate,ctime,cdescript,CFRANCHISENO,IENQUIRYNO) VALUES (enquiries.dDATE, ,"Enquiry Created",ENQUIRIES.CFRANCHISENO,ENQUIRIES.IENQUIRYNO)
INSERT INTO LAWNSURVEY (IENQUIRYNO,CFRANCHISENO) VALUES (ENQUIRIES.IENQUIRYNO,FRANCHISE.CFRANCHISENO)
SELECT sourceofenquiry
LOCATE FOR desc=msource
IF .not. FOUND()
INSERT INTO sourceofenquiry (desc,auto) VALUES (msource,.t.)
endif
SELECT jobtypes2
mtotalprice=0
SCAN
INSERT INTO enquiryprices (ienquiryno,cjobtype,treatmentcode,nmultiply,lbronze,lselected,nprice) values (enquiries.ienquiryno,jobtypes2.cjobtype,jobtypes2.code,;
jobtypes2.imultiply,jobtypes2.lbronze,jobtypes2.lbronze,ROUND(enquiries.nprice*jobtypes2.imultiply,2))
IF jobtypes2.lbronze
mtotalprice=mtotalprice+round(enquiries.nprice*jobtypes2.imultiply,2)
endif
endscan
mno=mno+1
ENDIF
=fclose(io)
DELETE FILE (mf)
mf=mhome+SYS(2000,mhome+"*.txt",1)
ENDDO
IF mno>0
=MESSAGEBOX(ALLTRIM(STR(mno))+" enquiries added from Outlook emails",64,"Enquiries received")
ENDIF
ofrmprogress.RELEASE
OFRMPROGRESS=.NULL.
USE IN enquiries
USE IN nextid
IF USED("lawnsurvey")
USE IN lawnsurvey
ENDIF
IF USED("sourceofenquiry")
USE IN sourceofenquiry
endif
IF USED("jobtypes2")
USE IN jobtypes2
ENDIF
IF USED("enquiryprices")
USE IN enquiryprices
ENDIF
PROCEDURE pip
PARAMETERS zfield,ztxt
IF zfield=1
zstart=0
ELSE
zstart=ATC(CHR(124),ztxt,zfield-1)
ENDIF
zend=ATC(CHR(124),ztxt,zfield)
mtxt=SUBSTR(ztxt,zstart+1,zend-zstart-1)
RETURN mtxt
>Hi
>
>I'm intending to use Redemption to read the my Outlook inbox, but does anyone have any examples having alreadty done this themselves. As ever, I'm under the kosh with regards to devlivering the functionality so I don't have the comfort of spending 2-3 days playing with Redemption in order to work it out in my own time.
>
>In short, I need to read the inbox, by selected received addresses and within a date range, and I need to take the message text and then process it. I don't imagine it's too complicated, but as I said, I'm well and truly under the kosh.
>
>Thanks in advance
Rob