[GH-ISSUE #68] [Enhancement] Add support for .eml message view keyboard shortcut #63

Closed
opened 2026-03-03 01:19:29 +03:00 by kerem · 5 comments
Owner

Originally created by @d99kris on GitHub (Jan 17, 2021).
Original GitHub issue: https://github.com/d99kris/nmail/issues/68

Originally assigned to: @d99kris on GitHub.

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.

Originally created by @d99kris on GitHub (Jan 17, 2021). Original GitHub issue: https://github.com/d99kris/nmail/issues/68 Originally assigned to: @d99kris on GitHub. 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.
kerem closed this issue 2026-03-03 01:19:30 +03:00
Author
Owner

@d99kris commented on GitHub (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}
<!-- gh-comment-id:761720093 --> @d99kris commented on GitHub (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} ```
Author
Owner

@Kabouik commented on GitHub (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!

<!-- gh-comment-id:761897888 --> @Kabouik commented on GitHub (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!
Author
Owner

@d99kris commented on GitHub (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.

<!-- gh-comment-id:762170920 --> @d99kris commented on GitHub (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.
Author
Owner

@Kabouik commented on GitHub (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}
<!-- gh-comment-id:762465543 --> @Kabouik commented on GitHub (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} ```
Author
Owner

@d99kris commented on GitHub (Jan 19, 2021):

Thanks for sharing!

On 2021-01-19 04:51 Kabouik notifications@github.com wrote:

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 message 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.

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

--
You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub:
https://github.com/d99kris/nmail/issues/68#issuecomment-762465543

<!-- gh-comment-id:762815394 --> @d99kris commented on GitHub (Jan 19, 2021): Thanks for sharing! On 2021-01-19 04:51 Kabouik <notifications@github.com> wrote: > `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 message 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. > > ``` > #!/usr/bin/env bash > > TMPDIR="$(mktemp -d)" > pushd "${TMPDIR}" > /dev/null && \ > mu extract --save-all -t "${1}" && \ > nnn -aRA && \ # Add nnn options here if necessary > popd > /dev/null > RV="${?}" > rm -rf ${TMPDIR} > exit ${RV} > ``` > > -- > You are receiving this because you modified the open/close state. > Reply to this email directly or view it on GitHub: > https://github.com/d99kris/nmail/issues/68#issuecomment-762465543
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nmail#63
No description provided.