(Go) Access Attached Message (Embedded Email)
How to access an email embedded within another email (i.e. an attached message). Note: This example requires Chilkat v11.0.0 or greater.
success := false
email := Email_Ref.html">chilkat.NewEmail()
// Load an email from a .eml
success = email.LoadEml("embeddedEmail.eml")
if success == false {
fmt.Println(email.LastErrorText())
email.DisposeEmail()
return
}
// Display how many attached emails are embedded within
// this one:
numAttached := email.NumAttachedMessages()
fmt.Println("numAttached = ", numAttached)
// Get the 1st attached message.
email2 := Email_Ref.html">chilkat.NewEmail()
success = email.GetAttachedEmail(0,email2)
if success == true {
// Display the subject, From, and a header field...
fmt.Println(email2.Subject())
fmt.Println(email2.From())
fmt.Println(*email2.GetHeaderField("X-SOMETHING"))
}
email.DisposeEmail()
email2.DisposeEmail()
|