Sample code for 30+ languages & platforms
Xojo Plugin

Render an Email to MIME Without Sending

See more SMTP Examples

Demonstrates the Chilkat MailMan.RenderToMime method, which renders an Email object as the MIME text that would be sent to the SMTP server, without actually sending it. This example builds a message and prints the rendered MIME.

Background: Rendering shows you exactly what MailMan would put on the wire — including headers it adds at send time and any signing/encryption — which is invaluable for debugging or logging before committing to a send. Notably, the Date header is filled in with the current date/time and a unique Message-ID is generated, while headers such as Content-Type, Content-Transfer-Encoding, X-Priority, and MIME-Version match what Email.GetMime would produce. Nothing is transmitted, so no SMTP connection is made.

Chilkat Xojo Plugin Downloads

Xojo Plugin
//  Demonstrates the MailMan.RenderToMime method, which renders an Email object as the MIME
//  text that would be sent to the SMTP server, without actually sending the email.

Dim mailman As New Chilkat.MailMan

//  Build the email to render.
Dim email As New Chilkat.Email
email.Subject = "Rendered email"
email.From = "alice@example.com"
Dim success As Boolean
success = email.AddTo("Bob","bob@example.com")
email.Body = "This message is rendered to MIME, not sent."

//  Render to MIME (no connection to the SMTP server is made).
Dim mime As String
mime = mailman.RenderToMime(email)
System.DebugLog(mime)

//  Sample output:
//  
//    MIME-Version: 1.0
//    Date: Fri, 17 Jul 2026 05:25:42 -0500
//    Message-ID: <E13F164829E44779462366BF1D8020CA210F8F1F@CHILKAT25>
//    Content-Type: text/plain; charset=us-ascii; format=flowed
//    Content-Transfer-Encoding: 7bit
//    X-Priority: 3 (Normal)
//    Subject: Rendered email
//    From: alice@example.com
//    To: Bob <bob@example.com>
//  
//    This message is rendered to MIME, not sent.
//  
//  Note: The Date header is automatically added with the current date/time, and a unique
//  Message-ID header is generated and added.  The other headers (Content-Type,
//  Content-Transfer-Encoding, X-Priority, and MIME-Version) have the same values you would
//  see with Email.GetMime.