AutoIt
AutoIt
Render an Email to MIME in a StringBuilder
See more SMTP Examples
Demonstrates the Chilkat MailMan.RenderToMimeSb method, which renders an Email object as MIME text and appends the result to a StringBuilder, without sending the email. This example renders a message into a StringBuilder and prints it.
Background: This is the
StringBuilder version of RenderToMime. Appending into a StringBuilder is more efficient when the MIME is large or when you plan to further inspect or manipulate it — searching, replacing, or accumulating additional text — without creating extra intermediate string copies.Chilkat AutoIt Downloads
Local $bSuccess = False
; Demonstrates the MailMan.RenderToMimeSb method, which renders an Email object as MIME text
; and appends the result to a StringBuilder (without sending the email).
$oMailman = ObjCreate("Chilkat.MailMan")
; Build the email to render.
$oEmail = ObjCreate("Chilkat.Email")
$oEmail.Subject = "Rendered email"
$oEmail.From = "alice@example.com"
$oEmail.AddTo("Bob","bob@example.com")
$oEmail.Body = "This message is rendered to MIME in a StringBuilder."
; Render the MIME into a StringBuilder.
$oSbMime = ObjCreate("Chilkat.StringBuilder")
$bSuccess = $oMailman.RenderToMimeSb($oEmail,$oSbMime)
If ($bSuccess = False) Then
ConsoleWrite($oMailman.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite($oSbMime.GetAsString() & @CRLF)