PowerBuilder
PowerBuilder
Load an Email from a .eml File
See more Email Object Examples
Demonstrates the Chilkat Email.LoadEml method, which loads a complete email from an .eml file. An EML file contains RFC822/MIME message text. On success, the loaded message replaces the entire current email — recipients, headers, bodies, related items, and attachments. This example loads an EML and reads its subject and from.
Background:
.eml is the standard on-disk format for a single email — it is simply the raw MIME saved to a file, which most mail clients can export and open. LoadEml parses that MIME into a fully populated Email object, giving you programmatic access to every part. It is the natural counterpart to SaveEml.Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Email
li_Success = 0
// Demonstrates the LoadEml method, which loads a complete email from an .eml file (an EML
// file contains RFC822/MIME message text). On success, the loaded message replaces the
// entire current email.
loo_Email = create oleobject
li_rc = loo_Email.ConnectToNewObject("Chilkat.Email")
if li_rc < 0 then
destroy loo_Email
MessageBox("Error","Connecting to COM object failed")
return
end if
li_Success = loo_Email.LoadEml("qa_data/eml/message.eml")
if li_Success = 0 then
Write-Debug loo_Email.LastErrorText
destroy loo_Email
return
end if
Write-Debug "Subject: " + loo_Email.Subject
Write-Debug "From: " + loo_Email.From
// Note: The path "qa_data/..." is a relative local filesystem path,
// relative to the current working directory of the running application.
destroy loo_Email