Xojo Plugin Requires Chilkat v11.0.0+
Xojo Plugin
Forward an email as an attachment
See more Email Object Examples
Attach the original Email to a new message as a message/rfc822 part. The recipient can open the attached email and read its original headers and body.
Chilkat Xojo Plugin Downloads
Dim success As Boolean
success = False
// Assumes Chilkat is unlocked. See Global Unlock Sample.
Dim original As New Chilkat.Email
success = original.LoadEml("message.eml")
If (success <> True) Then
System.DebugLog(original.LastErrorText)
Return
End If
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 = "Forwarded message"
email.Body = "The original email is attached."
success = email.AttachEmail(original)
If (success <> True) Then
System.DebugLog(email.LastErrorText)
Return
End If
success = email.SaveEml("forward-as-attachment.eml")
If (success <> True) Then
System.DebugLog(email.LastErrorText)
Return
End If
System.DebugLog("Saved forward-as-attachment.eml.")