AutoIt Requires Chilkat v11.0.0+
AutoIt
Create an email with plain-text and HTML bodies
See more Email Object Examples
Set the From and Reply-To addresses, add a recipient, and provide plain-text and HTML versions of the same body. Save the message as text-and-html.eml.
Chilkat AutoIt Downloads
Local $bSuccess = False
; Assumes Chilkat is unlocked. See Global Unlock Sample.
$oEmail = ObjCreate("Chilkat.Email")
$oEmail.FromName = "Sam Lee"
$oEmail.FromAddress = "sam@example.com"
$oEmail.ReplyTo = "replies@example.com"
$bSuccess = $oEmail.AddTo("Alex Rivera","alex@example.net")
If ($bSuccess <> True) Then
ConsoleWrite($oEmail.LastErrorText & @CRLF)
Exit
EndIf
$oEmail.Subject = "Sample message"
$oEmail.Charset = "utf-8"
; A custom header can carry a reference alongside the standard message fields.
$oEmail.AddHeaderField "X-Reference-ID","REF-42"
$bSuccess = $oEmail.AddPlainTextAlternativeBody("Read more at https://example.com/details.")
If ($bSuccess <> True) Then
ConsoleWrite($oEmail.LastErrorText & @CRLF)
Exit
EndIf
$bSuccess = $oEmail.AddHtmlAlternativeBody("<p><a href='https://example.com/details'>Read more</a></p>")
If ($bSuccess <> True) Then
ConsoleWrite($oEmail.LastErrorText & @CRLF)
Exit
EndIf
$bSuccess = $oEmail.SaveEml("text-and-html.eml")
If ($bSuccess <> True) Then
ConsoleWrite($oEmail.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("Saved text-and-html.eml." & @CRLF)