Sample code for 30+ languages & platforms
Zig

Load MIME Object from Email Object

See more Email Object Examples

Demonstrates how to load a Chilkat Mime object from a Chilkat Email object. (Copies the email into a Mime object.)

Chilkat Zig Downloads

Zig
const std = @import("std");
const chilkat = @import("chilkat");

pub fn main(init: std.process.Init) !void {
    const alloc = init.arena.allocator();

    const email = try chilkat.Email.init();
    defer email.deinit();
    try email.loadEml("qa_data/eml/sample.eml");

    // Write the full MIME of the email to a StringBuilder.
    const sb_mime = try chilkat.StringBuilder.init();
    defer sb_mime.deinit();
    email.getMimeSb(sb_mime) catch {};

    // Load the MIME object from the StringBuilder
    const mime = try chilkat.Mime.init();
    defer mime.deinit();
    try mime.loadMimeSb(sb_mime);

    std.debug.print("{s}\n", .{try mime.getMime(alloc)});
}