I am embedding an image in the body of an email and that works fine but the image is full size and takes up most of the email so I want to resize the image.
<div runat="server" id="dvEmailLogo">
<asp:Image runat="server" ID="EmailLogo" />
</div>
Code behind:
EmailLogo.ImageUrl = ConfigurationManager.AppSettings["LogoFileFolder"] + Company.Current.CompCode + "\\" + Company.Current.Logo + "";
Attachment inlineLogo = new Attachment(EmailLogo.ImageUrl);
mailMsg.Attachments.Add(inlineLogo);
string contentID = "Image";
inlineLogo.ContentId = contentID;
//To make the image display as inline and not as attachment
inlineLogo.ContentDisposition.Inline = true;
inlineLogo.ContentDisposition.DispositionType = DispositionTypeNames.Inline;
//To embed image in email
mailMsg.Body = "<htm><body> <img src=\"cid:" + contentID + "\"> </body></html>";
I tried adding the width and height to the url:
EmailLogo.ImageUrl = ConfigurationManager.AppSettings["LogoFileFolder"] + Company.Current.CompCode + "\\" + Company.Current.Logo + @"&width=200&height=200";
but this causes an error: System.IO.FileNotFoundException: Could not find file
I also tried adding the width the height to the div dvEmailLogo
but that didn't change the size