Prepare HTML email with embedded images

    Create an unsent email message whose local raster images travel with its HTML. The host retains responsibility for recipients, delivery, disposal and application-specific mail policy.

    This uses the same bounded local-image authorization as the editor image workflow.

    An embedded quarterly performance chart displayed in an Avalonia HTML Editor document.
    An embedded quarterly performance chart displayed in an Avalonia HTML Editor document.

    Use it in your application

    Set the trusted local base folder with BaseUrl before loading a document that refers to local files. Local resource selection is already on unless DisableLocalResourceSelection is set.

    Await email export after editing. A pending Source draft is applied before the message is built. Validated local and embedded raster images become linked email resources. Missing or denied optional local files retain their original references, so inspect the prepared message before delivery.

    The returned MailMessage is owned by your application. Set its envelope fields and pass it to your chosen delivery service only after your normal send checks. Dispose it after use.

    using var message = await editor.Content.GetEmailMessageWithLocalImagesEmbeddedAsync();
    message.Subject = "Account update";
    // Set recipients and deliver through your application's approved mail workflow.
    

    Related guides

    Last updated on Oct 30, 2026

    Put this into practice.

    Start with the C# Avalonia sample. Restore this edition's package and install the native browser prerequisites before running it.

    Prefer a guided look? Book a free live demo with our engineers - live on Zoom or Teams, never a chatbot.