Quickly view e-mail attachments from the command line? The 2019 Stack Overflow Developer Survey Results Are InBest way to archive attachments?Open html attachments externally in muttSetting up receive-only mail server and handling incoming mail and attachmentsDownloading an attachment from Inbox using the command-lineHow to set up Mutt and Spamassassimmutt and mail attachmentsHow to sync email contacts between computers for use in mutt?How do I troubleshoot Mutt html preview choking?Sending attachments with GNU mail to @kindle.comSend mail to SMTP server on same LAN from CLI (confused with Mutt and Postfix)
Why not take a picture of a closer black hole?
Is three citations per paragraph excessive for undergraduate research paper?
"as much details as you can remember"
Where to refill my bottle in India?
Why didn't the Event Horizon Telescope team mention Sagittarius A*?
Aging parents with no investments
Delete all lines which don't have n characters before delimiter
If I score a critical hit on an 18 or higher, what are my chances of getting a critical hit if I roll 3d20?
Why isn't airport relocation done gradually?
What did it mean to "align" a radio?
Can one be advised by a professor who is very far away?
Why isn't the circumferential light around the M87 black hole's event horizon symmetric?
How are circuits which use complex ICs normally simulated?
Is bread bad for ducks?
Return to UK after being refused entry years previously
For what reasons would an animal species NOT cross a *horizontal* land bridge?
Button changing it's text & action. Good or terrible?
Why is the maximum length of OpenWrt’s root password 8 characters?
slides for 30min~1hr skype tenure track application interview
What to do when moving next to a bird sanctuary with a loosely-domesticated cat?
How to type this arrow in math mode?
A poker game description that does not feel gimmicky
What is the meaning of the verb "bear" in this context?
Time travel alters history but people keep saying nothing's changed
Quickly view e-mail attachments from the command line?
The 2019 Stack Overflow Developer Survey Results Are InBest way to archive attachments?Open html attachments externally in muttSetting up receive-only mail server and handling incoming mail and attachmentsDownloading an attachment from Inbox using the command-lineHow to set up Mutt and Spamassassimmutt and mail attachmentsHow to sync email contacts between computers for use in mutt?How do I troubleshoot Mutt html preview choking?Sending attachments with GNU mail to @kindle.comSend mail to SMTP server on same LAN from CLI (confused with Mutt and Postfix)
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Description of the issue
I'm in a terminal at least half the time and, while doing e-mail, that mostly means being ssh
'd into a remote machine where I run the alpine
e-mail client to check my various imap
accounts. I don't get very many e-mail attachments and honestly don't want many: for me, e-mail remains a largely text-based affair. But it does happen from time to time that I get one, and in those cases I need either to go physically to where that machine is located in order to view the attachment, or I need to fire up a graphical browser and go to the site's webmail interface to view it. Neither of those are very desirable options.
A possible solution
I've come up with a more workable solution that that involves running mutt
(non-static installation) episodically on the local machine and using it for viewing e-mail attachments. I'd like to solicit here improvements and/or alternative solutions. My script looks like this:
#!/bin/sh
# create temporary ~/.muttrc and echo into it a line that will cause mail to be sorted from most recent first
touch ~/.muttrc
echo "set sort = reverse-date-received" >~/.muttrc
# make the ~/Mail directory so mutt won't prompt asking whether or not to create it
mkdir -p ~/Mail
# prompt for gmail user name and read that value into a variable to be used when invoking mutt
echo Please enter the username of the gmail account to be checked:
read username
mutt -f "imaps://$username@imap.gmail.com/INBOX"
# remove ~/Mail since it's otherwise not needed on this system
rm -rf ~/Mail
# now remove the temporary .muttrc
rm ~/.muttrc
When I receive an e-mail that has an attachment I'd like to view, I run that script on the local machine and view the target message and--via the agency of configurations already in place on the local machine--its attachment.
I believe the in-line comments make pretty clear the rather simplistic workings of this solution. The major drawback to this solution is that, since I have a few thousand e-mails in my account, it takes some minutes for mutt
to load them all. In almost all instances, what I'd rather have happen is for only about the 20 or so most recent e-mails to be loaded. But so far as I can tell, unless a more static installation of mutt
and associated files is made, that is not possible.
Further questions, solicitation of input
So, can anyone suggest improvements to my script of any sort, whether that be proposals for restricting the number of messages downloaded or any other enhancement? Have I overlooked other utilities that may allow me to accomplish this task? I believe telnet
can still be used for checking e-mail, but that is not a desirable solution for various reasons: telnet
is insecure, it seems there is not an easy way to identify target e-mails, and since it is not integrated with the system's automated file handling abilities (through use of configuration files like mime-types
and mailcap
) viewing attachments would not be at all straightforward.
Further thoughts. I know I could, for example, forward X
through an ssh tunnel so as to, essentially, view attachments using the alpine client that runs on the remote computer. But forwarding X
like that is kind of tricky and, so far as I understand it, is considered a security risk. Add to that the fact that I'm currently having problems (related to a recent migration) viewing attachments on that machine anyway, and forwarding X
does not seem like the right solution.
NOTE: As should be clear there are some gotchas in my script that could seriously mess up a static mutt installation--like creating and removing ~/Mail and .muttrc. Anyone trying to appropriate this solution to their own needs should therefore proceed with caution.
LATER EDIT: I've managed to speed up the loading of those thousands of e-mails by just slightly fleshing out my skeletal mutt
installation. It turns out that if I set up a local directory where mutt
can cache e-mail headers, then stipulate it's location in a local .muttrc
configuration file (as opposed to creating said file on the fly, as in my original directives), the loading of those thousands of e-mails goes a lot more quickly. So the content of a static .muttrc
would look something like
set sort = reverse-date-received"
set header_cache = "/home/user/tmp/mutt-tmp"
(mutt-tmp being the name of the directory where e-mail headers will be cached), while the "touch," "echo," and "rm ~/.muttrc" lines should be commented out and the line for invoking mutt
in the script I listed should be changed to something like mutt -F /home/user/local-muttrc -f "imaps://$username@imap.gmail.com/INBOX"
command-line scripting email mutt
add a comment |
Description of the issue
I'm in a terminal at least half the time and, while doing e-mail, that mostly means being ssh
'd into a remote machine where I run the alpine
e-mail client to check my various imap
accounts. I don't get very many e-mail attachments and honestly don't want many: for me, e-mail remains a largely text-based affair. But it does happen from time to time that I get one, and in those cases I need either to go physically to where that machine is located in order to view the attachment, or I need to fire up a graphical browser and go to the site's webmail interface to view it. Neither of those are very desirable options.
A possible solution
I've come up with a more workable solution that that involves running mutt
(non-static installation) episodically on the local machine and using it for viewing e-mail attachments. I'd like to solicit here improvements and/or alternative solutions. My script looks like this:
#!/bin/sh
# create temporary ~/.muttrc and echo into it a line that will cause mail to be sorted from most recent first
touch ~/.muttrc
echo "set sort = reverse-date-received" >~/.muttrc
# make the ~/Mail directory so mutt won't prompt asking whether or not to create it
mkdir -p ~/Mail
# prompt for gmail user name and read that value into a variable to be used when invoking mutt
echo Please enter the username of the gmail account to be checked:
read username
mutt -f "imaps://$username@imap.gmail.com/INBOX"
# remove ~/Mail since it's otherwise not needed on this system
rm -rf ~/Mail
# now remove the temporary .muttrc
rm ~/.muttrc
When I receive an e-mail that has an attachment I'd like to view, I run that script on the local machine and view the target message and--via the agency of configurations already in place on the local machine--its attachment.
I believe the in-line comments make pretty clear the rather simplistic workings of this solution. The major drawback to this solution is that, since I have a few thousand e-mails in my account, it takes some minutes for mutt
to load them all. In almost all instances, what I'd rather have happen is for only about the 20 or so most recent e-mails to be loaded. But so far as I can tell, unless a more static installation of mutt
and associated files is made, that is not possible.
Further questions, solicitation of input
So, can anyone suggest improvements to my script of any sort, whether that be proposals for restricting the number of messages downloaded or any other enhancement? Have I overlooked other utilities that may allow me to accomplish this task? I believe telnet
can still be used for checking e-mail, but that is not a desirable solution for various reasons: telnet
is insecure, it seems there is not an easy way to identify target e-mails, and since it is not integrated with the system's automated file handling abilities (through use of configuration files like mime-types
and mailcap
) viewing attachments would not be at all straightforward.
Further thoughts. I know I could, for example, forward X
through an ssh tunnel so as to, essentially, view attachments using the alpine client that runs on the remote computer. But forwarding X
like that is kind of tricky and, so far as I understand it, is considered a security risk. Add to that the fact that I'm currently having problems (related to a recent migration) viewing attachments on that machine anyway, and forwarding X
does not seem like the right solution.
NOTE: As should be clear there are some gotchas in my script that could seriously mess up a static mutt installation--like creating and removing ~/Mail and .muttrc. Anyone trying to appropriate this solution to their own needs should therefore proceed with caution.
LATER EDIT: I've managed to speed up the loading of those thousands of e-mails by just slightly fleshing out my skeletal mutt
installation. It turns out that if I set up a local directory where mutt
can cache e-mail headers, then stipulate it's location in a local .muttrc
configuration file (as opposed to creating said file on the fly, as in my original directives), the loading of those thousands of e-mails goes a lot more quickly. So the content of a static .muttrc
would look something like
set sort = reverse-date-received"
set header_cache = "/home/user/tmp/mutt-tmp"
(mutt-tmp being the name of the directory where e-mail headers will be cached), while the "touch," "echo," and "rm ~/.muttrc" lines should be commented out and the line for invoking mutt
in the script I listed should be changed to something like mutt -F /home/user/local-muttrc -f "imaps://$username@imap.gmail.com/INBOX"
command-line scripting email mutt
1
Hi. Do try to write shorter post if you want to be read and do expect answers... I suspect the down-vote was because of that. Cheers.
– Cbhihe
Mar 7 at 20:56
I don't really care about votes--whether up or down. I spent a lot of time on this post and condensed it as best I could (this is not by any means a first draft). If it proves too long then I'll have to find a different forum where I can solicit advice. Thanks
– MJiller
Mar 7 at 21:04
add a comment |
Description of the issue
I'm in a terminal at least half the time and, while doing e-mail, that mostly means being ssh
'd into a remote machine where I run the alpine
e-mail client to check my various imap
accounts. I don't get very many e-mail attachments and honestly don't want many: for me, e-mail remains a largely text-based affair. But it does happen from time to time that I get one, and in those cases I need either to go physically to where that machine is located in order to view the attachment, or I need to fire up a graphical browser and go to the site's webmail interface to view it. Neither of those are very desirable options.
A possible solution
I've come up with a more workable solution that that involves running mutt
(non-static installation) episodically on the local machine and using it for viewing e-mail attachments. I'd like to solicit here improvements and/or alternative solutions. My script looks like this:
#!/bin/sh
# create temporary ~/.muttrc and echo into it a line that will cause mail to be sorted from most recent first
touch ~/.muttrc
echo "set sort = reverse-date-received" >~/.muttrc
# make the ~/Mail directory so mutt won't prompt asking whether or not to create it
mkdir -p ~/Mail
# prompt for gmail user name and read that value into a variable to be used when invoking mutt
echo Please enter the username of the gmail account to be checked:
read username
mutt -f "imaps://$username@imap.gmail.com/INBOX"
# remove ~/Mail since it's otherwise not needed on this system
rm -rf ~/Mail
# now remove the temporary .muttrc
rm ~/.muttrc
When I receive an e-mail that has an attachment I'd like to view, I run that script on the local machine and view the target message and--via the agency of configurations already in place on the local machine--its attachment.
I believe the in-line comments make pretty clear the rather simplistic workings of this solution. The major drawback to this solution is that, since I have a few thousand e-mails in my account, it takes some minutes for mutt
to load them all. In almost all instances, what I'd rather have happen is for only about the 20 or so most recent e-mails to be loaded. But so far as I can tell, unless a more static installation of mutt
and associated files is made, that is not possible.
Further questions, solicitation of input
So, can anyone suggest improvements to my script of any sort, whether that be proposals for restricting the number of messages downloaded or any other enhancement? Have I overlooked other utilities that may allow me to accomplish this task? I believe telnet
can still be used for checking e-mail, but that is not a desirable solution for various reasons: telnet
is insecure, it seems there is not an easy way to identify target e-mails, and since it is not integrated with the system's automated file handling abilities (through use of configuration files like mime-types
and mailcap
) viewing attachments would not be at all straightforward.
Further thoughts. I know I could, for example, forward X
through an ssh tunnel so as to, essentially, view attachments using the alpine client that runs on the remote computer. But forwarding X
like that is kind of tricky and, so far as I understand it, is considered a security risk. Add to that the fact that I'm currently having problems (related to a recent migration) viewing attachments on that machine anyway, and forwarding X
does not seem like the right solution.
NOTE: As should be clear there are some gotchas in my script that could seriously mess up a static mutt installation--like creating and removing ~/Mail and .muttrc. Anyone trying to appropriate this solution to their own needs should therefore proceed with caution.
LATER EDIT: I've managed to speed up the loading of those thousands of e-mails by just slightly fleshing out my skeletal mutt
installation. It turns out that if I set up a local directory where mutt
can cache e-mail headers, then stipulate it's location in a local .muttrc
configuration file (as opposed to creating said file on the fly, as in my original directives), the loading of those thousands of e-mails goes a lot more quickly. So the content of a static .muttrc
would look something like
set sort = reverse-date-received"
set header_cache = "/home/user/tmp/mutt-tmp"
(mutt-tmp being the name of the directory where e-mail headers will be cached), while the "touch," "echo," and "rm ~/.muttrc" lines should be commented out and the line for invoking mutt
in the script I listed should be changed to something like mutt -F /home/user/local-muttrc -f "imaps://$username@imap.gmail.com/INBOX"
command-line scripting email mutt
Description of the issue
I'm in a terminal at least half the time and, while doing e-mail, that mostly means being ssh
'd into a remote machine where I run the alpine
e-mail client to check my various imap
accounts. I don't get very many e-mail attachments and honestly don't want many: for me, e-mail remains a largely text-based affair. But it does happen from time to time that I get one, and in those cases I need either to go physically to where that machine is located in order to view the attachment, or I need to fire up a graphical browser and go to the site's webmail interface to view it. Neither of those are very desirable options.
A possible solution
I've come up with a more workable solution that that involves running mutt
(non-static installation) episodically on the local machine and using it for viewing e-mail attachments. I'd like to solicit here improvements and/or alternative solutions. My script looks like this:
#!/bin/sh
# create temporary ~/.muttrc and echo into it a line that will cause mail to be sorted from most recent first
touch ~/.muttrc
echo "set sort = reverse-date-received" >~/.muttrc
# make the ~/Mail directory so mutt won't prompt asking whether or not to create it
mkdir -p ~/Mail
# prompt for gmail user name and read that value into a variable to be used when invoking mutt
echo Please enter the username of the gmail account to be checked:
read username
mutt -f "imaps://$username@imap.gmail.com/INBOX"
# remove ~/Mail since it's otherwise not needed on this system
rm -rf ~/Mail
# now remove the temporary .muttrc
rm ~/.muttrc
When I receive an e-mail that has an attachment I'd like to view, I run that script on the local machine and view the target message and--via the agency of configurations already in place on the local machine--its attachment.
I believe the in-line comments make pretty clear the rather simplistic workings of this solution. The major drawback to this solution is that, since I have a few thousand e-mails in my account, it takes some minutes for mutt
to load them all. In almost all instances, what I'd rather have happen is for only about the 20 or so most recent e-mails to be loaded. But so far as I can tell, unless a more static installation of mutt
and associated files is made, that is not possible.
Further questions, solicitation of input
So, can anyone suggest improvements to my script of any sort, whether that be proposals for restricting the number of messages downloaded or any other enhancement? Have I overlooked other utilities that may allow me to accomplish this task? I believe telnet
can still be used for checking e-mail, but that is not a desirable solution for various reasons: telnet
is insecure, it seems there is not an easy way to identify target e-mails, and since it is not integrated with the system's automated file handling abilities (through use of configuration files like mime-types
and mailcap
) viewing attachments would not be at all straightforward.
Further thoughts. I know I could, for example, forward X
through an ssh tunnel so as to, essentially, view attachments using the alpine client that runs on the remote computer. But forwarding X
like that is kind of tricky and, so far as I understand it, is considered a security risk. Add to that the fact that I'm currently having problems (related to a recent migration) viewing attachments on that machine anyway, and forwarding X
does not seem like the right solution.
NOTE: As should be clear there are some gotchas in my script that could seriously mess up a static mutt installation--like creating and removing ~/Mail and .muttrc. Anyone trying to appropriate this solution to their own needs should therefore proceed with caution.
LATER EDIT: I've managed to speed up the loading of those thousands of e-mails by just slightly fleshing out my skeletal mutt
installation. It turns out that if I set up a local directory where mutt
can cache e-mail headers, then stipulate it's location in a local .muttrc
configuration file (as opposed to creating said file on the fly, as in my original directives), the loading of those thousands of e-mails goes a lot more quickly. So the content of a static .muttrc
would look something like
set sort = reverse-date-received"
set header_cache = "/home/user/tmp/mutt-tmp"
(mutt-tmp being the name of the directory where e-mail headers will be cached), while the "touch," "echo," and "rm ~/.muttrc" lines should be commented out and the line for invoking mutt
in the script I listed should be changed to something like mutt -F /home/user/local-muttrc -f "imaps://$username@imap.gmail.com/INBOX"
command-line scripting email mutt
command-line scripting email mutt
edited Apr 7 at 14:50
Rui F Ribeiro
42k1483142
42k1483142
asked Mar 7 at 20:30
MJillerMJiller
9517
9517
1
Hi. Do try to write shorter post if you want to be read and do expect answers... I suspect the down-vote was because of that. Cheers.
– Cbhihe
Mar 7 at 20:56
I don't really care about votes--whether up or down. I spent a lot of time on this post and condensed it as best I could (this is not by any means a first draft). If it proves too long then I'll have to find a different forum where I can solicit advice. Thanks
– MJiller
Mar 7 at 21:04
add a comment |
1
Hi. Do try to write shorter post if you want to be read and do expect answers... I suspect the down-vote was because of that. Cheers.
– Cbhihe
Mar 7 at 20:56
I don't really care about votes--whether up or down. I spent a lot of time on this post and condensed it as best I could (this is not by any means a first draft). If it proves too long then I'll have to find a different forum where I can solicit advice. Thanks
– MJiller
Mar 7 at 21:04
1
1
Hi. Do try to write shorter post if you want to be read and do expect answers... I suspect the down-vote was because of that. Cheers.
– Cbhihe
Mar 7 at 20:56
Hi. Do try to write shorter post if you want to be read and do expect answers... I suspect the down-vote was because of that. Cheers.
– Cbhihe
Mar 7 at 20:56
I don't really care about votes--whether up or down. I spent a lot of time on this post and condensed it as best I could (this is not by any means a first draft). If it proves too long then I'll have to find a different forum where I can solicit advice. Thanks
– MJiller
Mar 7 at 21:04
I don't really care about votes--whether up or down. I spent a lot of time on this post and condensed it as best I could (this is not by any means a first draft). If it proves too long then I'll have to find a different forum where I can solicit advice. Thanks
– MJiller
Mar 7 at 21:04
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f504997%2fquickly-view-e-mail-attachments-from-the-command-line%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f504997%2fquickly-view-e-mail-attachments-from-the-command-line%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Hi. Do try to write shorter post if you want to be read and do expect answers... I suspect the down-vote was because of that. Cheers.
– Cbhihe
Mar 7 at 20:56
I don't really care about votes--whether up or down. I spent a lot of time on this post and condensed it as best I could (this is not by any means a first draft). If it proves too long then I'll have to find a different forum where I can solicit advice. Thanks
– MJiller
Mar 7 at 21:04