Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/CURL/Send Email/older examples/CURLS send email
Required plugins for this example: MBS CURL Plugin, MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /CURL/Send Email/older examples/CURLS send email
This example is the version from Wed, 14th Jul 2015.
Project "CURLS send email.rbp"
Filetype text
End FileTypes
Class Window1 Inherits Window
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() Upload End EventHandler
End Control
Control Result Inherits Label
ControlInstance Result Inherits Label
End Control
Control Server Inherits TextField
ControlInstance Server Inherits TextField
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control Username Inherits TextField
ControlInstance Username Inherits TextField
End Control
Control Passwort Inherits TextField
ControlInstance Passwort Inherits TextField
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control content Inherits TextArea
ControlInstance content Inherits TextArea
End Control
Control ToName Inherits TextField
ControlInstance ToName Inherits TextField
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control FromName Inherits TextField
ControlInstance FromName Inherits TextField
End Control
Control StaticText5 Inherits Label
ControlInstance StaticText5 Inherits Label
End Control
Control StaticText6 Inherits Label
ControlInstance StaticText6 Inherits Label
End Control
Control Subject Inherits TextField
ControlInstance Subject Inherits TextField
End Control
Control Thread1 Inherits Thread
ControlInstance Thread1 Inherits Thread
EventHandler Sub Run() DoUpload End EventHandler
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action() // update progress label if d<>Nil then if d.ProgressMessage<>"" then result.Text = d.ProgressMessage d.ProgressMessage = "" end if end if End EventHandler
End Control
Private Sub DoUpload() dim e as integer d=new UploadCURL // this is the file content here: d.InputData = UploadData dim tos(-1) as string tos.Append OptionMailRecipients // disable SSL verification = no security! d.OptionSSLVerifyHost = 0 d.OptionSSLVerifyPeer = 0 d.SetOptionMailRecipients tos d.OptionMailFrom = OptionMailFrom d.OptionUsername = OptionUsername d.OptionPassword = OptionPassword d.OptionURL = OptionURL d.OptionUpload=true d.YieldTime = true d.OptionVerbose = true d.CollectOutputData = true d.CollectDebugData = true e=d.Perform d.ProgressMessage = "Result: "+str(e) End Sub
Sub Upload() // we store stuff in variables here to avoid the ThreadAccessingUIException dim em as new EmailMessage em.AddRecipient ToName.text em.FromAddress = FromName.text em.Subject = EncodeEmailSubjectMBS(Subject.text) em.BodyPlainText = content.text UploadData = em.source OptionMailFrom = FromName.Text OptionMailRecipients = ToName.Text OptionPassword = Passwort.Text OptionURL = "smtp://"+server.Text OptionUsername = Username.Text Thread1.run End Sub
Note "About"
* Download a specific email id with IMAP: imap://user:password mail.candelatech.com/INBOX/;uid=1 * Download all email for this user with IMAP: imap://user:password mail.candelatech.com/ * Download all email in INBOX for this user with IMAP: imap://user:password mail.candelatech.com/INBOX?ALL * Download all email in INBOX with POP3: pop3://user:password mail.candelatech.com/ * Send email with SSL security using SMTP: smtps://user:password mail.candelatech.com
Property Private OptionMailFrom As string
Property Private OptionMailRecipients As string
Property Private OptionPassword As string
Property Private OptionURL As string
Property Private OptionUsername As string
Property Private UploadData As string
Property d As UploadCURL
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 UploadCURL Inherits CURLSMBS
EventHandler Sub DebugMessage(infotype as integer, data as string, dataSize as Integer) t.WriteLine data t.Flush End EventHandler
EventHandler Function Progress(dltotal as Int64, dlnow as Int64, ultotal as Int64, ulnow as Int64) As boolean if ultotal=0 then ProgressMessage = "Uploading..." else ProgressMessage = "Uploading "+Format(ulnow/ultotal,"-0%")+" "+stR(ulnow)+" of "+str(ultotal) end if End EventHandler
Sub Constructor() dim f as FolderItem = SpecialFolder.Desktop.Child("test.log") t = TextOutputStream.Create(f) End Sub
Property ProgressMessage As string
Property Private t As TextOutputStream
End Class
End Project

See also:

Feedback, Comments & Corrections

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

MBS FileMaker blog