We are making an app that do some process and finally send report via email to user via both port 587 & 465 . For port 567, we use standard System.Net.Mail and everything works fine. For the other port 465, we use AegisImplicitMail and we can't send image inline.
Here is the code for sending inline image with port 587
if (SettingDao.GetSMTPPort() == 587)
{
InlineChartExplicit = new Attachment(ChartDayImg);
string contentID = "inlineChartExplicit";
InlineChartExplicit.ContentId = contentID;
InlineChartExplicit.ContentDisposition.Inline = true;
InlineChartExplicit.ContentDisposition.DispositionType = DispositionTypeNames.Inline;
Html += @"<img src='cid:" + InlineChartExplicit.ContentId + @"' + style='width:50%;height:50%'/>";
}
and in emailService
if (InlineAttmExplicitSSL != null)
{
mail.Attachments.Add(InlineAttmExplicitSSL);
}
then we use the same code for port 465 using AegisImplicitMail, but the inline image does not work. Instead, we have an attachment at the end of the email
else if (SettingDao.GetSMTPPort() == 465)
{
InlineChartImplicit = new MimeAttachment(ChartDayImg);
string contentID = "inlineChartImplicit";
InlineChartImplicit.ContentId = contentID;
InlineChartImplicit.ContentDisposition.Inline = true;
InlineChartImplicit.ContentDisposition.DispositionType = DispositionTypeNames.Inline;
Html += @"<img src='cid:" + InlineChartImplicit.ContentId + @"' + style='width:50%;height:50%'/>";
}
in emailservice:
if (InlineAttmImplicitSSL != null)
{
mailMessage.Attachments.Add(InlineAttmImplicitSSL);
}
Is there something we missed for AegisImplicitMail? Thanks.