Create email using ASP.NET MVC views

Embedding images into emails

Postal provides an HTML helper extension method to allow embedding images into an email, instead of linking to an external image URL.

First, make sure your Web.config razor configuration contains the Postal namespace. This makes the helper available in your email views.

    <pages pageBaseType="System.Web.Mvc.WebViewPage">
        <add namespace="Postal" />

The EmbedImage method will embed the given image into the email and generate an <img/> tag to reference it.

Subject: Image


Postal will try to resolve the image’s filename, relative to the web application’s root directory.