Author |
|
mnoreen Newbie
Joined: 17 July 2012 Location: United States
Online Status: Offline Posts: 19
|
Posted: 24 March 2020 at 10:28am | IP Logged
|
|
|
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 |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 25 March 2020 at 2:09am | IP Logged
|
|
|
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 |
|
|
mnoreen Newbie
Joined: 17 July 2012 Location: United States
Online Status: Offline Posts: 19
|
Posted: 25 March 2020 at 6:29am | IP Logged
|
|
|
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 |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 25 March 2020 at 7:30am | IP Logged
|
|
|
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 |
|
|