Visual FoxPro
Visual FoxPro
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 Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loMailman
LOCAL loEmail
LOCAL loSbMime
lnSuccess = 0
* Demonstrates the MailMan.RenderToMimeSb method, which renders an Email object as MIME text
* and appends the result to a StringBuilder (without sending the email).
loMailman = CreateObject('Chilkat.MailMan')
* Build the email to render.
loEmail = CreateObject('Chilkat.Email')
loEmail.Subject = "Rendered email"
loEmail.From = "alice@example.com"
loEmail.AddTo("Bob","bob@example.com")
loEmail.Body = "This message is rendered to MIME in a StringBuilder."
* Render the MIME into a StringBuilder.
loSbMime = CreateObject('Chilkat.StringBuilder')
lnSuccess = loMailman.RenderToMimeSb(loEmail,loSbMime)
IF (lnSuccess = 0) THEN
? loMailman.LastErrorText
RELEASE loMailman
RELEASE loEmail
RELEASE loSbMime
CANCEL
ENDIF
? loSbMime.GetAsString()
RELEASE loMailman
RELEASE loEmail
RELEASE loSbMime