Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use this package #1

Open
blachawk opened this issue Apr 21, 2020 · 12 comments
Open

How to use this package #1

blachawk opened this issue Apr 21, 2020 · 12 comments

Comments

@blachawk
Copy link

blachawk commented Apr 21, 2020

I apologize if my request is obvious to do, but how do we use your package after we clone it locally to our environment? I have visual studio code open right now looking at the source code in your package. what next?

  • Do I simply create .eml files in this workspace?
  • Do I import your package somehow as an extension into VSCode?
@blachawk
Copy link
Author

I also found your extension in vscode, but like my previous question, how do we use it? I have 10 .eml files in my workspace directory, but right clicking over any of them gives me no option to preview eml files. What step am I missing?

@TomasHubelbauer
Copy link
Owner

Hi! What should happens is that you install the VS Code extension from the Marketplace (or within VS Code) like you did in your second post and then you click on the EML file and a new item appears in the VS Code file tree which is a folder named after the EML file. This is a virtual folder and it contains the contents of the EML/MSG file. Maybe VS Code API has changed since I last published the extension though and it might be broken now, I will check this in more detail in the coming days.

@AndreasLuckert
Copy link

email_viewer_showcase_try_to_use_it_with_EML

Hey Tomas,
I gotta admit that for me it's the same issue: I couldn't figure out how to actually use your extension.
I've installed it via the extension market, as usual with extensions.
Normally, somewhere some button appears like "Preview with EML-viewer" or similar, but with your extension nothing like that exists, and even after right-clicking through every spot which seemed promising at first I didn't find anything.
I'd even copied an EML-file into my current working directory, even though I'd ideally expect that upon opening an EML-file with VS Code it wouldn't even matter whether or not it's located in my current working directory as all that should matter is the filetype.

In the screenshot I've appended I tried to generate an impression what I tried and that everything is opened (EML-file, even working directory etc.).

I'm already curious if I'd missed out on something obvious, but either way I consider myself a digital native with lots of VS Code experience, and if I can't find out how to make it work, I suspect that it's generally a bit user-unfriendly, albeit I strongly believe that - once working - the extension will be great and very useful!
It's just a bit frustrating when you can't seem to figure out how to make it work in the first place :D

I'd suggest you, after having answered our concern here, that you include a small showcase in your extension description for future users :)

Anyway, thanks in advance for your consideration and work!
Cheers

@TomasHubelbauer
Copy link
Owner

Hey! You didn't miss anything, don't worry: This extension is supposed to work such that when you click on an EML file, a new virtual folder is created in your file explorer pane and in it are virtual files for each attachment and an HML file for the contents. Additionally, clicking that HTML file should render it instead of showing its source code.

Some time ago, VS Code API changed and now this does not work. The virtual directory with virtual files still works (for me at least, according to your screenshot, it does not work for you, which I'm confused as to why), but I think it would break if the file was not in the current workspace anyway.

Due to the breakage of the VS Code APIs, this extension is effectively broken now. I am investigating new VS Code APIs which could be used in a more direct way; just as the VS Code team removed some old APIs, they made new ones available which I think might be a solution here.

I will need to rewrite the extension, so this will take some time, but I will update you all once I'm done and I hope the new version will be more straightforward to use. In any case, this time, I'm definitely including an animation in the readme to show how it works. :-)

@TomasHubelbauer
Copy link
Owner

I'm almost done with the rewrite to use the webview panel API for the email preview. I ran into a VS Code bug microsoft/vscode#98873 which prevents me from finishing it off, but when this bug gets cleared or I get educated on why the problem is with my code after all and fix it, I'll update this issue thread.

@TomasHubelbauer
Copy link
Owner

Alright folks, the new version 5.0.0 is up and should appear in the VS Code extension marketplace any minute now.

I've rewritten the extension to use the VS Code webview API and to stop relying in the now deprecated and removed previewHtml VS Code command. I am sorry for the period of breakage between when this command was removed and now when I've fixed the code.

I have also updated the readme instructions on how to use: simply click to open any EML/MSG file and another tab with its preview will present. If you close it, to get it back, reopen the original EML/MSG file. Upon opening the EML/MSG file, a new folder will also be added to the VS Code workspace and it will contain an HTML file with the same name as the original EML/MSG file where you can inspect the HTML contents of the email (if you want to see just that and not the whole EML) and any email attachments will also be included in this virtual directory so you can access them directly, too. If you don't want this virtual directory for the email, simply remove it from the workspace using its context menu.

There is one known issue: the attachment links in the email preview do not work currently, but you can still get at the attachment using the virtual file system added to the workspace.

I plan on adding a few configuration options in the future:

  • Allow disabling the virtual file system for the email content and attachments since some people might prefer only using the attachment links in the email preview and not listing them in their Explorer pane and might not need access to the HTML extracted from the EML as they either don't use it at all or don't mind fishing in the actual EML for it
  • Allow using the VS Code custom editor API instead of the webview API, which will result in only a single tab opening instead of two (the email file raw text and the preview tab). This will result in a loss of ability to inspect the email file raw contents, but will make the experience somewhat nicer. I might add a fallback option of closing the preview and displaying the raw email file contents in order to preserve this functionality without having to switch the configuration option.

Hope you like this release, I'm all ears for feedback and bug reports and wish you both a good day!

@AndreasLuckert
Copy link

AndreasLuckert commented May 31, 2020

Comparison_Email_Viewer_and_Thunderbird_of_email_including_attachments_cleared

Hey Tomas,
that's awesome that you could resolve everything in such a short notice, thanks a lot for your great effort!
Probably you just needed to know that there's actual interest in your extension working correctly :)
I also like that I can open just any EML-file from wherever I want, independently of my current working space in VS Code.

As an additional stimulus, I've just opened an email with attachments in both Thunderbird (on the right) and your extension "Email Viewer" in VS Code (on the left) and found some differences in its depiction and ability to interact and access links and attaches files.
The screenshot is appended to this post as in my last one.

Concerning the differences:

  1. Cannot access attached files to the email opened in Email Viewer (see hovering information tooltop in screenshot when hovering the cursor over an attachment of choice). Consequently, up to know, I can use Email Viewer for reading and clicking on hyperlinks, but the attached files are not accessible. If I were to access these files, I'd have to open the email (EML-file) in a separate application such as Thunderbird. By contrast, when right- and left-clicking on the files in Email Viewer, nothing happens.
  2. Adds "undefined" file attachment, probably for every image within the same attachment of the currently opened email.
  3. Integrated/embedded images into the email-text cannot be displayed. For this, look at the logo of "global omnium" along with a water drop image below the complimentary close "Un saludo". This is displayed correctly in Thunderbird, but not in Email Viewer.

I hope this feedback helps you and others. Please keep us posted on further updates and keep up the great work!

@TomasHubelbauer
Copy link
Owner

Hey! That's great bug report, I'm reopening to address this. It would be a great help if you managed to somehow create an EML/MSG with no sensitive information where this still reproduces for me to use to debug, do you think you could do that?

Regarding your points:

  1. This is a known issue which I will be able to address soon after I verify what's the best way to resolve it. There are some security-related limitations the VS Code webview has and I think I know how to implement the links so that they work, but I need to study more of the VS Code API first to verify my intended approach is the optimal one. As a workaround - please let me know when if you open the email in VS Code, you also see a new directory appear in your Explorer pane and if in that directory you see all the attachments as if they were normal files? Like so:

image

As you can see in this screenshot, while the attachment links in the email do not work, once the email preview opened, the Explorer pane node by the name of the email file (html-email-2,eml) has appeared and in it there is the image.png attachment which is also the inline image in the preview.

This way you should be able to access your attachments until I can make the attachments and links working in the preview work the expected way.

  1. This is another thing that I would be very grateful for a reproduction email file if you could obtain one. If you do not have one without sensitive information, you can email one with the least amount of sensitive information to my email [email protected] and I will delete it immediately after I'm done with debugging this.

  2. This is also related to the same issue which causes links not to work. I hope I have a solution in mind for this and I will verify in the coming weeks when I have more free weekends to work on this extension.

Thank you again for your reports, I hope you will be able to produce a sample email file showing the problem with attachments so that I can use it to debug and I will keep this thread posted when I am able to resolve the issue which prevents the links and non-inline images from working! Take care.

@AndreasLuckert
Copy link

AndreasLuckert commented May 31, 2020

Hey again,

I've tried to create a minimal example out of the specific email mentioned in my previous post. It's included in this post.

  1. It's correct that after a while, when the untitled workspace has updated itself, the currently opened email and its attachments become visible in the explorer panel on the righthand side. These attachments can then be downloaded to hard-disk via right-click -> Download. However, one of the pictures cannot be displayed within VS Code, maybe due to having the same name as the other one, who knows. The error is then:

"An error occurred while loading the image. Open file using VS Code's standard text/binary editor?"

. Anyway, downloading to the harddisk seems to work via the explorer panel -> workspace dropdown menu.

  1. In my minimal example file, there was added again an additional cryptic attachment, this time just one while the real attachments contains 2 pictures:
    Fwd: Re: Seguimiento olores Oliva.eml.zip

  2. Weirdly, this time the embedded image was displayed correctly within VS Code. Maybe that's related to the fact that when opening large files, VS Code reduces drastically its displaying sophistication in order to save memory, but this is just an educated guess ;) Could also be something different.

Thanks in advance for your effort.

@TomasHubelbauer
Copy link
Owner

FYI I'm working on this and I have improved the performance a lot by parsing the email file before showing the explorer pane virtual directory node and while displaying a UI progress indicator, but I have ran into an issue which I need the VS Code team to help resolve before I can proceed:

microsoft/vscode#103181

@seanf
Copy link

seanf commented May 24, 2021

For anyone else having trouble with this, I found that this plugin only does its magic if I first open the directory containing the eml file as a folder. If I just open the eml file directly, nothing happens.

@mecampbellsoup
Copy link

@seanf that was helpful, nearly there... but seeing this error:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants