Hi @Donald Symmons ,
I suggest you could use LinkedResource. You could do like this:
private AlternateView Mail_Body()
{
string path = Server.MapPath(@"Images/photo.jpg");
LinkedResource Img = new LinkedResource(path, MediaTypeNames.Image.Jpeg);
Img.ContentId = "MyImage";
string str = @"
<table>
<tr>
<td>
<img src=cid:MyImage id='img' alt='' width='100px' height='100px'/>
</td>
</tr>
<tr>
<td>
'hello'
</td>
</tr>
</table>
";
AlternateView AV =
AlternateView.CreateAlternateViewFromString(str, null, MediaTypeNames.Text.Html);
AV.LinkedResources.Add(Img);
return AV;
}
using (MailMessage mm = new MailMessage("support@mywebsite.com", mailtxtbx.Text))
{
mm.Subject = "Activate Account";
mm.AlternateViews.Add(Mail_Body());
mm.IsBodyHtml = true;
SmtpClient SMTP = new SmtpClient("relay-hosting.secureserver.net", 25);
SMTP.UseDefaultCredentials = false;
SMTP.Credentials = new NetworkCredential()
{
UserName = "support@mywebsite.com",
Password = "xxxxxxxxxx"
};
SMTP.EnableSsl = false;
SMTP.Send(mm);
}
Best regards,
Yijing Sun
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.