Sample code for 30+ languages & platforms
Xojo Plugin Requires Chilkat v11.0.0+

Create, save, and reopen a plain-text email

See more Email Object Examples

Set the sender, recipient, subject, and plain-text body. Save the result as an EML file, then open it in a second Email object and read its contents.

Chilkat Xojo Plugin Downloads

Xojo Plugin
Dim success As Boolean
success = False

//  Assumes Chilkat is unlocked. See Global Unlock Sample.

Dim email As New Chilkat.Email
email.From = "Sam Lee <sam@example.com>"
success = email.AddTo("Alex Rivera","alex@example.net")
If (success <> True) Then
    System.DebugLog(email.LastErrorText)
    Return
End If

email.Subject = "Hello"
email.Body = "This is a plain-text message."
success = email.SaveEml("message.eml")
If (success <> True) Then
    System.DebugLog(email.LastErrorText)
    Return
End If

Dim received As New Chilkat.Email
success = received.LoadEml("message.eml")
If (success <> True) Then
    System.DebugLog(received.LastErrorText)
    Return
End If

System.DebugLog(received.From)
System.DebugLog(received.Subject)
System.DebugLog(received.GetPlainTextBody())