+2 votes

We have a template that has static HTML but also needs to store links to images.

We do NOT want to embed the images, because we want to track when the images are downloaded from our server for tracking purposes, so the image downloads act as a beacon so we know what user has opened the email.

How do you do this with Limilabs Mail.dll?

by

1 Answer

0 votes
 
Best answer

Simply set MailBuilder.Html property with your html, no need to do anything else:

MailBuilder builder = new MailBuilder();
builder.From.Add(new MailBox("alice@mail.com", "Alice"));
builder.To.Add(new MailBox("bob@mail.com", "Bob"));
builder.Subject = "This is HTML test";

builder.Html =                            
    "This is an <strong>HTML</strong> message, " +
    "<img src = 'http://www.example.com/image.jpeg' />.";

IMail email = builder.Create();

// Send the message
using (Smtp smtp = new Smtp())
{
      smtp.Connect("server.example.com");   // or ConnectSSL for SSL
      smtp.UseBestLogin("user", "password");

      smtp.SendMessage(email);

      smtp.Close();
}
by (301k points)
...