AutoIt Requires Chilkat v11.0.0+
AutoIt
Convert image data URLs to related MIME parts
See more Email Object Examples
Start with HTML that contains image bytes in a data URL. Convert it to conventional CID references and inspect the resulting related-item count before saving.
Chilkat AutoIt Downloads
Local $bSuccess = False
; Assumes Chilkat is unlocked. See Global Unlock Sample.
$oEmail = ObjCreate("Chilkat.Email")
$oEmail.From = "Workshop team <events@example.com>"
$bSuccess = $oEmail.AddTo("Alex Rivera","alex@example.net")
If ($bSuccess <> True) Then
ConsoleWrite($oEmail.LastErrorText & @CRLF)
Exit
EndIf
$oEmail.Subject = "Workshop registration"
$oEmail.SetHtmlBody "<html><body><p>Registration confirmed.</p><img src=""data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="" alt=""Mark""></body></html>"
$bSuccess = $oEmail.ConvertInlineImages()
If ($bSuccess <> True) Then
ConsoleWrite($oEmail.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("Related images: " & $oEmail.NumRelatedItems & @CRLF)
ConsoleWrite($oEmail.GetHtmlBody() & @CRLF)
$bSuccess = $oEmail.SaveEml("related-images.eml")
If ($bSuccess <> True) Then
ConsoleWrite($oEmail.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("Saved related-images.eml." & @CRLF)