PowerShell Requires Chilkat v11.0.0+
PowerShell
Create an inline forward
See more Email Object Examples
Create a forward from a saved email, set the forwarding author and destination, and inspect the generated subject and body. Save the draft before submitting it to SMTP. To introduce the original with a separate cover note, use the attached-message example.
Chilkat PowerShell Downloads
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"
$success = $false
# Assumes Chilkat is unlocked. See Global Unlock Sample.
$original = New-Object Chilkat.Email
$success = $original.LoadEml("alternatives.eml")
if ($success -ne $true) {
$($original.LastErrorText)
exit
}
$forward = New-Object Chilkat.Email
$success = $original.ToForward($forward)
if ($success -ne $true) {
$($original.LastErrorText)
exit
}
$forward.From = "Workshop team <events@example.com>"
$success = $forward.AddTo("Coordinator","coordinator@example.net")
if ($success -ne $true) {
$($forward.LastErrorText)
exit
}
$($forward.Subject)
if ($forward.HasHtmlBody() -eq $true) {
$($forward.GetHtmlBody())
}
else {
$($forward.GetPlainTextBody())
}
$success = $forward.SaveEml("forward.eml")
if ($success -ne $true) {
$($forward.LastErrorText)
exit
}
$("Saved forward.eml.")