Sample code for 30+ languages & platforms
AutoIt Requires Chilkat v11.0.0+

Create, save, and reopen a plain-text email

See more Email Object Examples

Set the sender, recipient, subject, and plain-text body. Save the result as an EML file, then open it in a second Email object and read its contents.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

;  Assumes Chilkat is unlocked. See Global Unlock Sample.

$oEmail = ObjCreate("Chilkat.Email")
$oEmail.From = "Sam Lee <sam@example.com>"
$bSuccess = $oEmail.AddTo("Alex Rivera","alex@example.net")
If ($bSuccess <> True) Then
    ConsoleWrite($oEmail.LastErrorText & @CRLF)
    Exit
EndIf

$oEmail.Subject = "Hello"
$oEmail.Body = "This is a plain-text message."
$bSuccess = $oEmail.SaveEml("message.eml")
If ($bSuccess <> True) Then
    ConsoleWrite($oEmail.LastErrorText & @CRLF)
    Exit
EndIf

$oReceived = ObjCreate("Chilkat.Email")
$bSuccess = $oReceived.LoadEml("message.eml")
If ($bSuccess <> True) Then
    ConsoleWrite($oReceived.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite($oReceived.From & @CRLF)
ConsoleWrite($oReceived.Subject & @CRLF)
ConsoleWrite($oReceived.GetPlainTextBody() & @CRLF)