General information
Category:
Third party products
>>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
Thanks...very much! Your code worked. I had to fiddle around a bit and I got it to do what I have been working on for a while. I didn't know about the sys(2333,0) and that may have made the difference. I really appreciate the help.
Now I go back to making it work in my context.
>*--
> 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
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only