We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Missing Logo on Office 365/GMail - SMTP Send

Hi,


I am sending a HTML message which has a logo embedded using SMTP Send.
The logo seems to be missing on an Office365/Gmail account. I tried sending a similar mail using outlook client and I could view it in Office365/Gmail so doesn’t seem to be a mail setting issue. Any insights would be helpful. Thank you.

Hi Sathyapriya,


Following sample code creates a message having Html body with linked image. This mail is sent and on receiving end, image is displayed fine. Could you please give it a try and let us know the feedback?

String path = “”;<o:p></o:p>

MailMessage SampleMsg = new MailMessage();

SampleMsg.Subject = "Test Email 5.7 with Linked resource in AlternateView";

AlternateView plainView = AlternateView.CreateAlternateViewFromString("This is my plain text content", null, "text/plain");

AlternateView htmlView = AlternateView.CreateAlternateViewFromString("Here is an embedded image.", null, "text/html");

LinkedResource logo = new LinkedResource(path + @"Desert.jpg", MediaTypeNames.Image.Jpeg);

logo.ContentId = "companyLogo";

htmlView.LinkedResources.Add(logo);

SampleMsg.IsBodyHtml = true;

SampleMsg.AlternateViews.Add(plainView);

SampleMsg.AlternateViews.Add(htmlView);

//Set From, To, ReplyToList

SampleMsg.From = new MailAddress("user1@gmail.com");

SampleMsg.To.Add(new MailAddress("user2@gmail.com"));

MailAddressCollection coll = new MailAddressCollection();

coll.Add(new MailAddress("user3@gmail.com"));

//msgReply.ReplyToList = coll;

SmtpClient client = new SmtpClient("smtp.gmail.com", 587,"user1@gmail.com", "password", SecurityOptions.SSLExplicit);

client.Send(SampleMsg);

Thank you for the details.

I tried using the below sample code to send an RTF File with images in a HTML body using SMTPClient. However when I received the emails, the htmldocument and image are added as attachments and not sent as message body. Please advice.

Document RTFDocument = new Document(RTFfilename);
MemoryStream mhtmlStream = new MemoryStream();
RTFDocument.Save(mhtmlStream, Aspose.Words.SaveFormat.Mhtml);
mhtmlStream.Position = 0;
MailMessage SampleMsg = MailMessage.Load(mhtmlStream);

Hi Sathyapriya,


We have investigated this issue at our end with the latest version of Aspose.Email for .NET 5.8.0 and no such problem was faced on Office365 as well as Gmail. Please try it with the attached document and share your feedback with us.

Please can you share the sample code.

I tried with the document you attached and the message is sent with empty body and attachments -document.html and the image.001.jpeg.
However I want the ‘RTF’ to be sent as message body.

Hi,


I have used the following code at our end which is extension to your sample code provided above.

Code:

Aspose.Words.Document RTFDocument = new Aspose.Words.Document(“test.rtf”);
MemoryStream mhtmlStream = new MemoryStream();
RTFDocument.Save(mhtmlStream, Aspose.Words.SaveFormat.Mhtml);
//RTFDocument.Save(“test.mhtml”, Aspose.Words.SaveFormat.Mhtml);
mhtmlStream.Position = 0;
MailMessage SampleMsg = MailMessage.Load(mhtmlStream);

SampleMsg.Save(“RtfMsg.msg”, Aspose.Email.Mail.SaveOptions.DefaultMsgUnicode);//for viewing only

SampleMsg.Subject = “RTF Body Sending Test”;
SampleMsg.To = "to@gmail.com";
SampleMsg.From = "from@gmail.com";

SmtpClient client = GetSmtpClient();//some smtp client
client.Send(SampleMsg);

Thank you.

Sorry I have the problem in Exchange Server - Outlook 2010 now and as you mentioned it looks good on office365, Gmail.
Please can you check.

Hi,


I tried above sample code and sent email to my sample account on Exchange Server 2010. Mail is received fine and image is properly visible. This issue needs further investigation on your exchange server account, therefore could you please share a sample test account temporarily along with credentials? It will help us to re-produce the issue and provide assistance accordingly.

I could get this working by saving the message and loading it again. Please could you let me know if aspose mail could interpret the html body and associated files created using Microsoft.Office.Interop.Word library. If it is possible please could you share a sample code that could do this.

Hi,


We haven’t tested it with such generated by Interop but HTML is a standard language and output of InterOp will definitely comply it. Thus, it shouldn’t be an issue with the Email API to load these. If you face any issue while working with these, please share your sample file and code with us so that we can investigate the issue and assist you further.

Attached is the sample HTML and the associated files generated by Word interop.

I am using AlternateView and LinkedResources to send, using the sample code you sent earlier -seen in the message trail. But the associated files are not linked they are sent as separate attachments. Please advice.

Hi Sathyapriya,


Thank you for sharing the output files of Interop.

We have checked these at our end and found that there is no linkage between the header.htm and logo image image001.png. If you open the html file in editor, you won’t find any image tag referring to this image. This is the reason that when you send the html file, it doesn’t find any linked resource image and is missing at the remote end. If you just open the HTML file in browser, you will see that there is no image in the html file. This verifies that the API has nothing to do with the missing logo. Please let us know if you have further concerns about this.