Platforms to show: All Mac Windows Linux Cross-Platform

/CURL/Send Email/older examples/CURLS send email Web Edition
Function:
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 Web Edition
This example is the version from Wed, 12th Oct 2021.
Project "CURLS send email Web Edition.xojo_binary_project"
Class App Inherits WebApplication
End Class
Class Session Inherits WebSession
Const ErrorDialogCancel = "Do Not Send"
Const ErrorDialogMessage = "This application has encountered an error and cannot continue."
Const ErrorDialogQuestion = "Please describe what you were doing right before the error occurred:"
Const ErrorDialogSubmit = "Send"
Const ErrorThankYou = "Thank You"
Const ErrorThankYouMessage = "Your feedback helps us make improvements."
Const NoJavascriptInstructions = "To turn Javascript on, please refer to your browser settings window."
Const NoJavascriptMessage = "Javascript must be enabled to access this page."
End Class
Class MainPage Inherits WebPage
Control Server Inherits WebTextField
ControlInstance Server Inherits WebTextField
End Control
Control Label1 Inherits WebLabel
ControlInstance Label1 Inherits WebLabel
End Control
Control Username Inherits WebTextField
ControlInstance Username Inherits WebTextField
End Control
Control Label2 Inherits WebLabel
ControlInstance Label2 Inherits WebLabel
End Control
Control Passwort Inherits WebTextField
ControlInstance Passwort Inherits WebTextField
End Control
Control Label3 Inherits WebLabel
ControlInstance Label3 Inherits WebLabel
End Control
Control ToName Inherits WebTextField
ControlInstance ToName Inherits WebTextField
End Control
Control Label4 Inherits WebLabel
ControlInstance Label4 Inherits WebLabel
End Control
Control FromName Inherits WebTextField
ControlInstance FromName Inherits WebTextField
End Control
Control Label5 Inherits WebLabel
ControlInstance Label5 Inherits WebLabel
End Control
Control Subject Inherits WebTextField
ControlInstance Subject Inherits WebTextField
End Control
Control Label6 Inherits WebLabel
ControlInstance Label6 Inherits WebLabel
End Control
Control content Inherits WebTextArea
ControlInstance content Inherits WebTextArea
End Control
Control Button1 Inherits WebButton
ControlInstance Button1 Inherits WebButton
EventHandler Sub Action() Thread1.run End EventHandler
End Control
Control Thread1 Inherits Thread
ControlInstance Thread1 Inherits Thread
EventHandler Sub Run() DoUpload End EventHandler
End Control
Control Result Inherits WebLabel
ControlInstance Result Inherits WebLabel
End Control
Private Sub DoUpload() dim e as integer dim d as UploadCURL dim em as new EmailMessage em.AddRecipient ToName.text em.FromAddress = FromName.text em.Subject = EncodeEmailSubjectMBS(Subject.text) em.BodyPlainText = content.text d=new UploadCURL // this is the file content here: d.InputData = em.source dim tos(-1) as string tos.Append ToName.Text // disable SSL verification = no security! d.OptionSSLVerifyHost = 0 d.OptionSSLVerifyPeer = 0 d.Result = result d.OptionMailFrom = FromName.Text d.SetOptionMailRecipients tos d.OptionUsername = Username.Text d.OptionPassword = Passwort.text d.OptionURL = "smtp://"+server.Text d.OptionUpload=true d.YieldTime = true e=d.Perform result.text = "Result: "+str(e) End Sub
Note "About"
* Download a specific email id with IMAP: imap://mail.candelatech.com/INBOX/;uid=1 * Download all email for this user with IMAP: imap://mail.candelatech.com/ * Download all email in INBOX for this user with IMAP: imap://mail.candelatech.com/INBOX?ALL * Download all email in INBOX with POP3: pop3://mail.candelatech.com/ * Send email with SSL security using SMTP: smtps://mail.candelatech.com
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, percent as double) As boolean if ultotal=0 then Result.text = "Uploading..." else Result.text = "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 Result As WebLabel
Property Private t As TextOutputStream
End Class
End Project

See also:

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

Feedback: Report problem or ask question.

The biggest plugin in space...