Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Objects

 AfterLogic Forum : MailBee.NET Objects
Subject Topic: GetHtmlAndRelatedFilesInMemory issue Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
mnoreen
Newbie
Newbie


Joined: 17 July 2012
Location: United States
Online Status: Offline
Posts: 16
Posted: 24 March 2020 at 10:28am | IP Logged Quote mnoreen

Hello --

This is pretty much what I am trying to do: display an .EML file in a web browser. I happened upon:

https://afterlogic.com/docs/mailbee-net-tutorials/display-html-plain-text-message/display-message-with-embedded-pictures

and that seemed right on target. I wanted to use the InMemory version, so I have:

        string body = msg.GetHtmlAndRelatedFilesInMemory(virtualPathPrefix);
        Response.Write(body);


The HTML of the email does display, but none of the inline graphics. The src attribute is showing the value of my virtualPathPrefix var, but no incrementing value or anything appended at all. The alt attribute is varied. Sometimes it shows "cid:image..." and sometimes it shows ... something else, but I'm not sure where it's getting the string.

Does the GetHtmlAndRelatedFilesInMemory() method support this or do I have to actually persist things to disk first?
Back to Top View mnoreen's Profile Search for other posts by mnoreen
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2157
Posted: 25 March 2020 at 2:09am | IP Logged Quote Alex

Hello,

As the documentation on onGetHtmlAndRelatedFilesInMemory method states, "It does not save anything to disk, just replaces content-id references in the HTML body with a provided path and auto-incrementing index".

If you want the method which actually saves inline attachments to disk, use GetHtmlAndSaveRelatedFiles method instead. Or, you can use GetHtmlWithBase64EncodedRelatedFiles which replaces all inline attachments with base64 encoded images directly embedded in the HTML (nothing is needed to be saved to disk then).

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
mnoreen
Newbie
Newbie


Joined: 17 July 2012
Location: United States
Online Status: Offline
Posts: 16
Posted: 25 March 2020 at 6:29am | IP Logged Quote mnoreen

Yes, I did discover the GetHtmlWithBase64EncodedRelatedFiles method and that worked great.

Now I just need to figure out what to do about attachments. That method returns begin and end html tags, so I'm trying to figure out to insert/merge my own html fragment to list the attachments. Perhaps a feature request?

Thanks again.
Back to Top View mnoreen's Profile Search for other posts by mnoreen
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2157
Posted: 25 March 2020 at 7:30am | IP Logged Quote Alex

It's too specific for a particular application (how to render the list of attachments). If you want to add another content to the HTML of the email (not necessarily attachment list, it can be other proeprties of email, or controls, or whatever), this would be a very different task.

For instance, you may decide to parse the HTML into some document object model and insert what you need there.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide