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: 11.2.0 build 590 for .NET 4.5
public ReplaceUriWithCidHandler OnReplaceUriWithCid { get; set; }

Property Value

Type: ReplaceUriWithCidHandler
The default value is a null reference (Nothing in Visual Basic).
Setting this property only makes sense before calling LoadBodyText(String, MessageBodyType, Encoding, ImportBodyOptions) or ImportRelatedFiles(ImportRelatedFilesOptions) methods. See ReplaceUriWithCidHandler topic for details.
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);

See Also