When sending an HTML email with inlineImages, you can't....
The following code exposes enough in the SendGrid.cs class to work for my needs (ability to include file streams rather than just the Filenames would probably be handy)
There are more elegant solutions, but this one works in a pinch.
---------------Add to SendGrid.cs (in Mail project)------------
public struct inlineImage
{
public inlineImage(string _FileName, string _Cid)
{
FileName = _FileName;
Cid = _Cid;
}
public string FileName;
public string Cid;
}
public List<inlineImage> htmlInlineImages = new List<inlineImage> { };
-----------Modify CreateMimeMessage's if (Html != null) block------------
if (Html != null)
{
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(Html, null, "text/html");
foreach (inlineImage X in htmlInlineImages)
{
LinkedResource imageResource = new LinkedResource(X.FileName);
imageResource.ContentId = X.Cid;
htmlView.LinkedResources.Add(imageResource);
}
message.AlternateViews.Add(htmlView);
}
When sending an HTML email with inlineImages, you can't....
The following code exposes enough in the SendGrid.cs class to work for my needs (ability to include file streams rather than just the Filenames would probably be handy)
There are more elegant solutions, but this one works in a pinch.
---------------Add to SendGrid.cs (in Mail project)------------
-----------Modify CreateMimeMessage's if (Html != null) block------------