Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/CURL/CURLS imap email download

You find this example project in your Plugins Download as a Xojo (Real Studio) project file within the examples folder: /CURL/CURLS imap email download
This example is the version from Sat, 25th Apr 2014.
Notes: Last modified: Sat, 25th Apr 2014
Project "CURLS imap email download.rbp"
Filetype text
End FileTypes
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
End ControlInstance
Sub Action() Start End
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End ControlInstance
End Control
Control Server Inherits TextField
ControlInstance Server Inherits TextField
End ControlInstance
End Control
Control Username Inherits TextField
ControlInstance Username Inherits TextField
End ControlInstance
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End ControlInstance
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End ControlInstance
End Control
Control Passwort Inherits TextField
ControlInstance Passwort Inherits TextField
End ControlInstance
End Control
Control ResultText Inherits Label
ControlInstance ResultText Inherits Label
End ControlInstance
End Control
Control MyThread Inherits Thread
ControlInstance MyThread Inherits Thread
End ControlInstance
Sub Run() Result = d.Perform d.done = true End
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End ControlInstance
End Control
Control content Inherits TextArea
ControlInstance content Inherits TextArea
End ControlInstance
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
End ControlInstance
Sub Action() if d<>Nil then if d.Message.len > 0 then List.AddRow d.Message d.Message = "" end if if d.done then finish end if end if End
End Control
Sub Finish() ResultText.text="Result: "+str(result) if result = 56 then ResultText.text = ResultText.text + " no email" end if if result = 0 then dim em as new EmailMessage em.Source = d.datas content.Text = em.BodyPlainText // IMAP in CURL currently does not give headers :-( dim ed as EmailHeaders = em.Headers dim c as integer = ed.Count-1 for i as integer = 0 to c List.AddRow ed.Name(i) List.Cell(List.LastIndex,1)=ed.Value(ed.Name(i)) next end if d = nil End
Sub Start() List.DeleteAllRows content.text = "" dim e as integer d=new DownloadCURL d.OptionURL = "imap://"+Server.Text+"/INBOX" d.OptionUsername = Username.Text d.OptionPassword = Passwort.Text d.YieldTime = true d.OptionVerbose = true d.OptionHeader = true MyThread.run End
Note About
Property Result As integer
Property d As DownloadCURL
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
Class DownloadCURL Inherits CURLSMBS
Sub DebugMessage(infotype as integer, data as string) t.WriteLine data t.Flush End
Function Progress(dltotal as double, dlnow as double, ultotal as double, ulnow as double) As boolean if dltotal=0 then Message = "Downloading..." else Message = "Downloading "+Format(dlnow/dltotal,"0%") end if Return false End
Function Write(data as string) As integer datas=Datas+data t.WriteLine data t.Flush Return lenb(Data) End
Sub Constructor() dim f as FolderItem = SpecialFolder.Desktop.Child("test.log") t = f.CreateTextFile End
Property Message As string
Property datas As string
Property done As Boolean
Property Private t As TextOutputStream
End Class
End Project

See also:

The items on this page are in the following plugins: MBS CURL Plugin.

MBS Xojo Plugins