Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

/CURL/Send Email/CURLS send email
Feedback.

Function:
You find this example project in your Plugins Download as a Xojo (Real Studio) project file within the examples folder: /CURL/Send Email/CURLS send email
This example is the version from Sun, 4th Jan 2014.
Notes: Last modified: Sun, 4th Jan 2014
Project "CURLS send email.rbp"
FileTypes
Filetype text
End FileTypes
Class Window1 Inherits Window
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
End ControlInstance
Sub Action() Upload End
End Control
Control Result Inherits Label
ControlInstance Result Inherits Label
End ControlInstance
End Control
Control Server Inherits TextField
ControlInstance Server Inherits TextField
End ControlInstance
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End ControlInstance
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End ControlInstance
End Control
Control Username Inherits TextField
ControlInstance Username Inherits TextField
End ControlInstance
End Control
Control Passwort Inherits TextField
ControlInstance Passwort Inherits TextField
End ControlInstance
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End ControlInstance
End Control
Control content Inherits TextArea
ControlInstance content Inherits TextArea
End ControlInstance
End Control
Control ToName Inherits TextField
ControlInstance ToName Inherits TextField
End ControlInstance
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End ControlInstance
End Control
Control FromName Inherits TextField
ControlInstance FromName Inherits TextField
End ControlInstance
End Control
Control StaticText5 Inherits Label
ControlInstance StaticText5 Inherits Label
End ControlInstance
End Control
Control StaticText6 Inherits Label
ControlInstance StaticText6 Inherits Label
End ControlInstance
End Control
Control Subject Inherits TextField
ControlInstance Subject Inherits TextField
End ControlInstance
End Control
Control Thread1 Inherits Thread
ControlInstance Thread1 Inherits Thread
End ControlInstance
Sub Run() DoUpload End
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
End ControlInstance
Sub Action() // update progress label if d<>Nil then if d.ProgressMessage<>"" then result.Text = d.ProgressMessage d.ProgressMessage = "" end if end if End
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 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 = 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
Note About
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
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 ultotal=0 then ProgressMessage = "Uploading..." else ProgressMessage = "Uploading "+Format(ulnow/ultotal,"-0%")+" "+stR(ulnow)+" of "+str(ultotal) end if End
Sub Constructor() dim f as FolderItem = SpecialFolder.Desktop.Child("test.log") t = f.CreateTextFile End
Property ProgressMessage As string
Property Private t As TextOutputStream
End Class
End Project

See also:

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




Links
MBS Xojo Plugins