Xojo Plugin
Xojo Plugin
Quickly Send a Simple Email
See more SMTP Examples
Demonstrates the Chilkat MailMan.QuickSend method, which sends a simple email to a single recipient without requiring the application to create an Email object. The arguments are the from address, the to address, the subject, the body, and the SMTP server hostname. This example sends a plain-text message in one call.
Background:
QuickSend is a convenience for the most common case: one plain-text message to one recipient. It skips the build-an-Email-object step, so it's ideal for quick notifications and alerts. When you need more — HTML bodies, attachments, multiple recipients, Cc/Bcc, or custom headers — build an Email object and use SendEmail instead. Authentication settings still come from the MailMan properties.Chilkat Xojo Plugin Downloads
Dim success As Boolean
success = False
// Demonstrates the MailMan.QuickSend method, which sends a simple email to a single
// recipient without requiring the application to create an Email object. The arguments are
// the from address, the to address, the subject, the body, and the SMTP server hostname.
Dim mailman As New Chilkat.MailMan
// SMTP authentication settings (the SMTP server hostname is passed to QuickSend).
mailman.SmtpPort = 465
mailman.SmtpSsl = True
mailman.SmtpUsername = "user@example.com"
mailman.SmtpPassword = "myPassword"
// Send a simple email in one call.
success = mailman.QuickSend("alice@example.com","bob@example.com","Quick hello","This is a quick message.","smtp.example.com")
If (success = False) Then
System.DebugLog(mailman.LastErrorText)
Return
End If
System.DebugLog("Email sent.")
// Note: Explicitly connecting/authenticating is optional. Chilkat MailMan automatically
// connects and authenticates -- using the property settings above -- whenever a server
// operation requires it. Calling the explicit connect/authenticate methods can still be
// helpful to determine whether a failure occurs while connecting or while authenticating.