LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-18-2016, 11:14 AM   #1
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Posts: 1,622
Blog Entries: 40

Rep: Reputation: Disabled
[Mutt] Can I process a current mail in a shell command from Mutt?


Good evening.

I have defined macros in Mutt which are working fine.

But is there a way to pass an email or attachment to a shell-command that I enter after the "!" switch? The documentation appears to contain nothing about this possibility and I believe thus, that it is not possible.

What I seek is a behavior similar to vim, where I can pass the current file as an argument to such shell-commands, using the '%' symbol and it may just be that I do not know the right symbol for use in mutt...

Hypothetical use-case “Call the command 'my_command' on the currently selected element from the pager”:
First, I hit '!', the command-prompt appears.
Code:
Shell-command: my_command %
Just say 'NO' and I will ask no more.

Last edited by Michael Uplawski; 06-18-2016 at 11:16 AM. Reason: double negation.
 
Old 06-18-2016, 12:10 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,324
Blog Entries: 28

Rep: Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142
Code:
~$ mutt [somebody@somewhere.com]
Mutt will prompt for a subject, then open the editor.

There are more elaborate ways, in which you can specify the subject and text and even an attachment in the command. See man mutt or search the web for "send mail mutt command line."
 
Old 06-18-2016, 03:04 PM   #3
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Posts: 1,622

Original Poster
Blog Entries: 40

Rep: Reputation: Disabled
I am sorry, but maybe I have not well put my question. More background then. When I write email, I do not talk about addresses.

I am already in the pager and see all my mails, received or sent, in Mutt. What I want is make use of the Mutt-internal command-prompt. You can hit the "!" key and will see a command-prompt on the lower edge of the program interface, just like in the vim editor.

My question is more: How can I pass the currently selected element (mail or mail-component) to a command that I compose on this command-prompt. Vim uses the "%" symbol for this purpose.

I can do all that I want with Mutt macros, but for occasional calls to arbitrary commands, it would be overkill to define a lot of, else unused, macros.

Screen shot of an authentic mutt-session and yet another hypothetic command-line which does not work ;-) And sorry for the uncivilized language in the picture.

Last edited by Michael Uplawski; 06-18-2016 at 03:19 PM. Reason: Screen shot
 
Old 06-18-2016, 09:07 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,324
Blog Entries: 28

Rep: Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142
I did indeed misunderstand your question. Thanks for clarifying.

As I understand now (I'm paraphrasing so that, if I don't yet misunderstand you can correct me and perhaps that might help someone else help you), you want to "shell-out" of mutt while bringing/using some element that is within mutt along to be manipulated in that shell.

Unfortunately, I don't know enough to help with that. I wish I did.

Last edited by frankbell; 06-18-2016 at 09:12 PM.
 
1 members found this post helpful.
Old 06-19-2016, 04:28 AM   #5
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Posts: 1,622

Original Poster
Blog Entries: 40

Rep: Reputation: Disabled
@frankbell. Yes, this is probably a way to put it (and probably more intelligible to native english-speakers).

I implicitly question the usefulness of the shell interface in Mutt, if there is no way to work on mail-components. Moving focus to a second terminal only requires that I push Ctrl+PageUp (or +PageDown). If “from within” Mutt I can only call ls, cd etc. or start some other program, I would deem this highly superfluous and the integrated command-line more a joke than a valuable addition.

Or maybe Mutt is just too close to vim, slrn and other such gifts from above, that I am spoiled now and asking too much. ;-)
 
Old 06-21-2016, 02:56 AM   #6
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Posts: 1,622

Original Poster
Blog Entries: 40

Rep: Reputation: Disabled
Additional information:
You can explicitly pipe the currently selected or several tagged mails to a command by using the pipe-symbol ("|") instead of "!". This may at first glance look like an answer to my question, but is not.

What works is, for example, something like “open the currently selected mail in less”:
Code:
| less
The pipe symbol opens yet another kind of command interpreter.

But I define a functional shell something which allows also “grep the current mail for the expression http”. For an ordinary text-file, you would use in the simplest of cases the command
Code:
~$ cat mail_message.txt | grep http
I may be dumb, but neither the so-called command-shell, not the pipe-function let me do this in Mutt. In the past I have defined macros for all such actions, but they are used only occasionally and this is dumb work, in deed. Most of the time, it is far better to just open the mail for editing (hotkey 'e') and issue any command in the vim-editor.

Last edited by Michael Uplawski; 06-21-2016 at 03:07 AM. Reason: wording
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
(SOLVED) Unable to send mail with Mutt after recent Slackware Current updates frankbell Slackware 4 08-28-2015 12:19 AM
LXer: Send emails from Linux Console Using Mutt,Mail & Telnet Command LXer Syndicated Linux News 0 05-06-2013 12:02 AM
mutt does not honour mutt.rc 'use_from' entry when accepting piped input davidchall Linux - Software 0 05-28-2012 02:13 AM
LXer: Get started with Mutt, the ultra fast command-line-based mail client… LXer Syndicated Linux News 0 02-17-2010 05:30 PM
Mutt experts - Mutt won't use the Maildir I specify in .muttrc moistTowelette Debian 2 08-24-2009 08:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration