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

[Enhancement] Add support for .eml message view keyboard shortcut #68

Closed
d99kris opened this issue Jan 17, 2021 · 5 comments
Closed

[Enhancement] Add support for .eml message view keyboard shortcut #68

d99kris opened this issue Jan 17, 2021 · 5 comments
Assignees

Comments

@d99kris
Copy link
Owner

d99kris commented Jan 17, 2021

This is a feature request to add a keyboard shortcut to view the entire email message (.eml file) from message view as well as message list view, in an external program.

A user-configurable command shall be used for opening the eml-file.

This request is related to #42 and #66.

@d99kris
Copy link
Owner Author

d99kris commented Jan 17, 2021

Functionality for this has been implemented in above commit. Default key binding is w to view the .eml file in an external program. By default xdg-open is used on Linux, but it can be customized by setting msg_viewer_cmd= in ~/.nmail/main.conf.

Here's a minimal script example that can be used in order to view the message parts and attachments in the file manager nnn:

#!/usr/bin/env bash

TMPDIR="$(mktemp -d)"
pushd "${TMPDIR}" > /dev/null && \
munpack -t "${1}" && \
nnn && \
popd > /dev/null
RV="${?}"
rm -rf ${TMPDIR}
exit ${RV}

@Kabouik
Copy link
Contributor

Kabouik commented Jan 17, 2021

Wow. That was fast and the result is spectacular. Thanks a lot for providing a nnn script. I was planning on writing one myself but I can assure you the result would have been far from being this clean.

This added a lot of potential flexibility to nmail with just nnn base features. And for those who like nnn, it is worth configuring it more because much more can be done with its plugins in addition to what I already listed in #66 (i.e., preview pane and image preview within terminal). Works beautifully with the nmail integration. My 0x0.st upload plugin will be put to good use too!

There are some messages that show no parts in nnn, I observed that with some newsletter html emails despite an html part visible in the nmail attachment view, but I see that it is a munpack limitation ("Did not find anything to unpack from 2362.eml").

I have yet to run some tests to see what is the use case for parts_viewer_cmd in addition to msg_viewer_cmd.

Thanks, it's huge for me!

@d99kris
Copy link
Owner Author

d99kris commented Jan 18, 2021

That's great to hear! 👍

Yeah, I don't know if munpack is the best option for parsing eml files - it was just the first that came up when I searched online. There may be better options.

@Kabouik
Copy link
Contributor

Kabouik commented Jan 18, 2021

munpack seems to be a great little tool, and lightweight. However I think I am getting better results with mu extract --save-all from the maildir-utils package despite the much bigger size of the package. For instance it successfully shows me html parts in the messages from which munpack failed to extract parts, and also shows much better formatting in the plain text parts, while I was getting some encoding issues with munpack-extracted plain text files. I'm not saying yet that mu extract solves this all, time will tell.

#!/usr/bin/env bash

TMPDIR="$(mktemp -d)"
pushd "${TMPDIR}" > /dev/null && \
mu extract --save-all "${1}" && \
nnn -aRA && \ # Add nnn options here if necessary
popd > /dev/null
RV="${?}"
rm -rf ${TMPDIR}
exit ${RV}

@d99kris
Copy link
Owner Author

d99kris commented Jan 19, 2021 via email

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

2 participants