MessageBuilderConfigOnReplaceUriWithCid Property
Gets or sets the delegate to be called whenever MailBee tries to import the resource referenced in the HTML body and replace it with CID.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax
public ReplaceUriWithCidHandler OnReplaceUriWithCid { get; set; }

Property Value

Type: ReplaceUriWithCidHandler
The default value is a null reference (Nothing in Visual Basic).
Remarks
Setting this property only makes sense before calling LoadBodyText(String, MessageBodyType, Encoding, ImportBodyOptions) or ImportRelatedFiles(ImportRelatedFilesOptions) methods. See ReplaceUriWithCidHandler topic for details.
Examples
This sample loads some HTML from a file including referenced images. However, images from "https" resources are not imported and their <IMG SRC> remain intact.
using System;
using MailBee;
using MailBee.Mime;

class Sample
{
    static bool SkipSecureResources(string uri)
    {
        if (uri.ToLower().StartsWith("https:"))
        {
            return false;
        }
        return true;
    }

    static void Main(string[] args)
    {
        MailMessage msg = new MailMessage();

        // Set the delegate and import HTML with related resources. All the references starting with "https:"
        // will be left intact. Other references will be replaced with CIDs generated by MailBee and the files
        // mentioned by these references will be attaced to the message. Each attachment will have Content-ID
        // equal to the corresponding CID in the HTML body.
        msg.Builder.OnReplaceUriWithCid = new ReplaceUriWithCidHandler(SkipSecureResources);
        msg.LoadBodyText(@"C:\Temp\test.html", MessageBodyType.Html, null,
            ImportBodyOptions.ImportRelatedFiles | ImportBodyOptions.ImportRelatedFilesFromUris);

        msg.SaveMessage(@"C:\Temp\test.eml");
    }
}
See Also