0 votes

I have previously used easymail in the past.

There was a great routine which took a HTML file and basically made an email from it, together with all embedded images etc. Not sure if there is anything similar?

by

1 Answer

0 votes
 
Best answer

Use MailBuilder.LoadHtml method. It sets HTML version of the message. Modifies passed HTML, so that img tags reference inline images. Adds all images that can be found on disk to Visuals collection. Extracts plain text from HTML and sets IMail.Text property.

    MailBuilder builder = new MailBuilder();
    builder.LoadHtml(@"<img src=""c:\BRHB00001256/IS20KG.bmp"" align=baseline>");

    Assert.AreEqual(1, builder.Visuals.Count);
    Assert.AreEqual("IS20KG.bmp", ((MimeData)builder.Visuals[0]).FileName);
    StringAssert.IsMatch(@"\<img src=\""cid\:(.+)@mail\.dll\"".*", builder.Html);
by (301k points)
...