Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Anyone using the Mabry Internet Mail control successfull
Message
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00092705
Message ID:
00092724
Views:
18
>For example, I want to receive an email with an attachment and save the >attachment to the local disk of the client....

Hi, here some test code for a "Check Mail" command button:

thisform.MMail.Host="myhost"
thisform.MMail.LogonName="myname"
thisform.MMail.LogonPassword="mypass"
thisform.MMail.ConnectType=1
thisform.MMail.Blocking=.T.
thisform.MMail.Timeout=30
thisform.MMail.Connect

nTemp=MESSAGEBOX("There are "+ ;
ALLTRIM(STR(thisform.MMail.PopMessageCount))+" message(s)")

nMSG=0
IF thisform.MMail.PopMessageCount > 0
*--
*-- Save each "message" in the client's temp directory
*--
FOR nCnt = 1 TO thisform.MMail.PopMessageCount
thisform.MMail.MessageID=ALLTRIM(STR(nCnT))
thisform.MMail.Flags=260
thisform.MMail.ReadMessage
thisform.MMail.Flags=4
thisform.MMail.ReadMessage
thisform.MMail.Flags=32
nMSG=nMSG+1
thisform.MMail.DstFileName="c:\temp\mail"+ALLTRIM(STR(nMSG))+".msg"
thisform.MMail.WriteMessage
thisform.MMail.HostDelete
ENDFOR
ENDIF
thisform.MMail.Disconnect

IF nMSG > 0
*--
*-- Process each saved message and extract attachments
*-- Saving each attachment in the client's temp directory
*--
FOR nCnt = 1 TO nMSG
thisform.MMail.Flags=2
thisform.MMail.SrcFileName= ;
"c:\temp\mail"+ALLTRIM(STR(nCnT))+".msg"
thisform.MMail.ReadMessage
IF thisform.MMail.Parts > 1
FOR nPrt = 1 TO thisform.MMail.Parts-1
thisform.MMail.Part=nPrt
thisform.MMail.Descend
thisform.MMail.Flags=40
nBEG=AT('"',thisform.MMail.ContentDisposition)+1
nEND=AT('"',thisform.MMail.ContentDisposition,2)
cFILE=SUBSTR(thisform.MMail.ContentDisposition,nBEG,nEND-nBEG)
thisform.MMail.DstFileName="c:\temp\"+cFILE
thisform.MMail.Decode
thisform.MMail.Ascend
ENDFOR
ENDIF
ENDFOR
ENDIF

Hope this helps, I assume you know about SYS(2333,0) etc.

Rgds
Petras
Petras Virzintas
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform