Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

3 votes
1 answers
429 views
Display name and/or path of currently viewed email in mutt/neomutt
I'm using [`neomutt`](https://neomutt.org) (an updated fork of [`mutt`](http://www.mutt.org)) as my CLI MUA (read: mail reading software in the terminal) and have all my messages synced offline using [`isync`/`mbsync`](https://isync.sourceforge.io/) and stored in the `maildir`-format on my `Debian S...
I'm using [neomutt](https://neomutt.org) (an updated fork of [mutt](http://www.mutt.org)) as my CLI MUA (read: mail reading software in the terminal) and have all my messages synced offline using [isync/mbsync](https://isync.sourceforge.io/) and stored in the maildir-format on my Debian Stable system. Sometimes I want to reply to a message and attach another email (e.g. as a reference). This can be easily done when using the maildir-storage format since all messages are separate files; I just need to attach the file in my local folder. The problem is that I have difficulties finding the email files. Obviously I can search through all of my messages (e.g. by using [mu](https://www.djcbsoftware.nl/code/mu/) , which is my mail indexer) and then attach it, but this is tedious. It would be a lot easier to just display the path and filename somewhere when I read an email, optimally in my pager within neomutt. But despite looking for a solution, I wasn't able to find that. Any ideas or workarounds?
n0542344 (416 rep)
Dec 28, 2020, 01:08 PM • Last activity: Feb 25, 2025, 02:59 PM
0 votes
2 answers
128 views
Mutt/Neomutt with Maildir do not save sent email
Since I changed from mbox to Maildir format, mutt/neomutt does not save sent email in ~/.muttrc I have ``` et mbox_type=Maildir set folder="~/Maildir" set mask="!^\\.[^.]" set mbox="~/Maildir" set spoolfile="~/Maildir" set postponed="+.Drafts" # this I added after but nothing changed set record="+.S...
Since I changed from mbox to Maildir format, mutt/neomutt does not save sent email in ~/.muttrc I have
et mbox_type=Maildir
set folder="~/Maildir"    
set mask="!^\\.[^.]"
set mbox="~/Maildir"      
set spoolfile="~/Maildir"     
set postponed="+.Drafts"  # this I added after but nothing changed
set record="+.Sent"       # this I added after but nothing changed
the ~/Maildir tree
$ ls -R Maildir/
Maildir/:
cur  Draft  draftbox  new  outbox  Sent  sentbox  tmp  trash

Maildir/cur:
1737497891.V10307I5fbe8M146242.myhostname      1738400102.V10306Ic54e2M329900.myhostname:2,S
1737572852.V10307I5fbcaM212202.myhostname:2,S  1738779407.V10306Ic0d38M429367.myhostname:2,S
1737654476.V10307I5fb93M26824.myhostname       1739001859.V10306Ic55a1M270393.myhostname:2,S
1737718132.V10307I5fa87M173575.myhostname:2,S  1739210926.V10306Ic580cM502391.myhostname:2,S

Maildir/Draft:

Maildir/new:
1738155609.V10307Ic36a2M239995.myhostname  1738915125.V10306Ic2a87M548369.myhostname
1738264124.V10306Ic6fd5M305286.myhostname  1739089986.V10306Ic14bbM498891.myhostname
1738278926.V10306Ic0ccdM774234.myhostname  1739296548.V10306Ice92dM403450.myhostname
1738475978.V10306Ic1cefM416932.myhostname  1739360330.V10306Ic0e16M153268.myhostname
1738610292.V10306Ic1d23M237920.myhostname  1739465208.V10306Ic1905M306194.myhostname
1738697646.V10306Ic56abM101647.myhostname  1739466647.V10306Ica30cM369123.myhostname
1738864130.V10306Ic557eM199187.myhostname

Maildir/Sent:

Maildir/tmp:
If inside mutt/neomutt I try to open one of that *.myhostname file, mutt/neomutt says "~/Maildir/new/1739466647.V10306Ica30cM369123.myhostname is not a mailbox" Anyone has some advice ?
klatls (33 rep)
Feb 13, 2025, 06:12 PM • Last activity: Feb 17, 2025, 05:10 AM
0 votes
0 answers
30 views
How to add ",a" flag to the filename delivered in maildir by procmail?
I learned that by adding ",a" to the file name in a maildir, the Evolution software considers the mail as an important message. So I would like to tag some messages using Procmail but whatever I do, I go around in circles, because I do not know the file name before it is delivered by Procmail, and w...
I learned that by adding ",a" to the file name in a maildir, the Evolution software considers the mail as an important message. So I would like to tag some messages using Procmail but whatever I do, I go around in circles, because I do not know the file name before it is delivered by Procmail, and when it is already delivered, it is immediately renamed by various external mechanisms by moving it from new to cur. Is there a solution only with Procmail? I know other solutions, but they do not interest me here.
Chris972 (43 rep)
Nov 30, 2024, 05:44 PM • Last activity: Dec 1, 2024, 08:46 AM
1 votes
2 answers
153 views
Be notified of new mail in any Maildir inbox under ~/Mail, in the Zsh shell
I have a cron job that fetches new mail from several mail servers every 20 minutes. The mail is automatically sorted into Maildir mailboxes in a hierarchy under `~/Mail`. I want to be notified in the shell if a new message has arrived in any local mailbox in the last 20 minutes. I'm using the `zsh`...
I have a cron job that fetches new mail from several mail servers every 20 minutes. The mail is automatically sorted into Maildir mailboxes in a hierarchy under ~/Mail. I want to be notified in the shell if a new message has arrived in any local mailbox in the last 20 minutes. I'm using the zsh shell.
Kusalananda (354338 rep)
Jul 14, 2024, 03:53 PM • Last activity: Aug 13, 2024, 12:22 AM
0 votes
2 answers
125 views
How should an email message, represented as a single file, be added to a Maildir?
The naming conventions of Maildirs seem pretty elaborate. I downloaded a message from Outlook's web interface and added it to a Maildir by naming it `added` and putting it in a `new` folder. `mbsync` and `mu4e` seemed happy enough with the result, but I wouldn't be surprised if I ran into trouble by...
The naming conventions of Maildirs seem pretty elaborate. I downloaded a message from Outlook's web interface and added it to a Maildir by naming it added and putting it in a new folder. mbsync and mu4e seemed happy enough with the result, but I wouldn't be surprised if I ran into trouble by making a habit out of this. Is there a program to add a file to a Maildir in the right way? Ideally such an operation wouldn't require configuring and running a full-blown mail server on my machine.
Kodiologist (145 rep)
Dec 5, 2022, 08:42 PM • Last activity: Dec 3, 2023, 03:51 AM
1 votes
1 answers
176 views
How do I pipe my raw keystrokes through a command before sending it through ssh to remote systems
To better specify my question, I have decided that I want every keystroke to be piped to a package called safecat which uses the maildir algorithm, which is in turn delivering it's output to a remote machine via ssh. I just feel like when i do mess up, which i will, it would be really cool have that...
To better specify my question, I have decided that I want every keystroke to be piped to a package called safecat which uses the maildir algorithm, which is in turn delivering it's output to a remote machine via ssh. I just feel like when i do mess up, which i will, it would be really cool have that record of exactly what i did on that particular machine to result in such hilarious catastrophe. If there is a totally different means to achieve the same result, I'm not fussed, but from what i can tell the final keystrokes are difficult to recover.
Adam Ledger (181 rep)
May 9, 2023, 04:13 PM • Last activity: May 31, 2023, 06:07 PM
2 votes
1 answers
1296 views
Convert Thunderbird IMAP mail folder to maildir
I currently use `mu4e` with a `maildir` storage format as my email client. I used to use Thunderbird with an old Outlook based email account for work, using IMAP. In my `.thunderbird` directory tree, I can still find a directory with files called `INBOX`, `Sent-1` etc. where the files appear to be c...
I currently use mu4e with a maildir storage format as my email client. I used to use Thunderbird with an old Outlook based email account for work, using IMAP. In my .thunderbird directory tree, I can still find a directory with files called INBOX, Sent-1 etc. where the files appear to be concatenated email messages corresponding to a folder with the corresponding filename. There are also corresponding .msf files for (most) of the email files in the same directory. I want to convert this directory and its files into the maildir format, for ease of use. There are a bunch of tools out there for converting mbox formats in Thunderbird to maildir, including the [perl script mb2md](http://batleth.sapienti-sat.org/projects/mb2md/) (which I believe is derived/related to [this Python script](https://www.gerg.ca/hacks/mb2md/)) . I've tried this out and get the error
Fatal: Source is not an mbox file or a directory!
Are my files in the mbox format? They don't have the appropriate extension (i.e. .mbox) but as I understood it the format is just a single file per mail folder as I've described above. Or is there something else I have to do? **EDIT** This is the command that generates the error. I have not created the maildir_outlook directory, but I don't think that's the problem.
perl mb2md-3.20.pl -s outlook.office365.com/INBOX -d maildir_outlook
For clarity, the INBOX file looks like this (after some anonymization):
From
Received: from ***.OUTLOOK.COM by ***.OUTLOOK.COM with HTTPS via ***.OUTLOOK.COM with HTTPS via *** Fri, 11 Oct 2019 08:04:18 +000
Received: from *** ...
Received: from *** ...
Authentication-Results: spf=pass (sender IP is ***.***.***.***) 
smpt.mailfrom=*** ...
Received-SPF: Pass ...
Received: from ...
Received: from ...
Received: from ...
...
    MESSAGE BODY
and this just repeats with all the emails contained in the INBOX folder. The result of file INBOX is:
INBOX: ASCII text, with very long lines (678), with CRLF line terminators
nonreligious (153 rep)
Feb 20, 2023, 11:37 AM • Last activity: Feb 24, 2023, 04:06 PM
9 votes
1 answers
30582 views
How to make postfix create maildir?
How do you make postfix create maildir folders automatically for all users? I have these two lines in postfix main.cf, which supposed do create maildir folder after the first mail but it is not working. What am I missing? home_mailbox = Maildir mailbox_command = At the moment mail looks to sent, but...
How do you make postfix create maildir folders automatically for all users? I have these two lines in postfix main.cf, which supposed do create maildir folder after the first mail but it is not working. What am I missing? home_mailbox = Maildir mailbox_command = At the moment mail looks to sent, but nowhere to be found.
Jason (131 rep)
May 30, 2014, 03:17 AM • Last activity: Feb 22, 2023, 11:52 PM
1 votes
1 answers
960 views
mail: How do I mark an email as unread?
I am using `mail` from GNU Mailutils to read the contents of a Maildir. For emails that have already been marked as read, is there a way to mark them as unread in `mail`?
I am using mail from GNU Mailutils to read the contents of a Maildir. For emails that have already been marked as read, is there a way to mark them as unread in mail?
Flux (3238 rep)
Oct 10, 2021, 09:52 PM • Last activity: Jan 10, 2022, 07:11 AM
5 votes
1 answers
7573 views
How do I set up alpine to read local Unix generated mail
Linux delivers mail to home directory: `/home/linker/Maildir` under which are 3 directories `new`, `cur`, `tmp`. When I type `mail` I get `mail: /home/linker/Maildir/: Is a directory`, which is not useful. I have installed alpine but can't get it access the Maildir directory (above) to read the mail...
Linux delivers mail to home directory: /home/linker/Maildir under which are 3 directories new, cur, tmp. When I type mail I get mail: /home/linker/Maildir/: Is a directory, which is not useful. I have installed alpine but can't get it access the Maildir directory (above) to read the mails in new. I guess its all about the .pinerc
user1082991 (153 rep)
Mar 25, 2012, 07:38 AM • Last activity: Dec 1, 2021, 04:23 PM
2 votes
1 answers
777 views
mutt: determine local path of current mail
**CHALLENGE** I want to determine the local path of the currently viewed mail within mutt and transfer it to a bash script, before or after saving the mail to a local project folder. **CONCEPT** I am using `mutt` together with `offlineimap` and `msmtp` in order to decouple my mail infrastructure fro...
**CHALLENGE** I want to determine the local path of the currently viewed mail within mutt and transfer it to a bash script, before or after saving the mail to a local project folder. **CONCEPT** I am using mutt together with offlineimap and msmtp in order to decouple my mail infrastructure from the necessity of a permanent internet connection. In doing so, I find my mails within the mailfile structure where each ` and ` may live in its own local folder structure:
Mail/
|-- /
|   |-- cur/
|   |   |-- 1584016380.RPi-18:2,
|   |   |-- 1595241604.RPi-18:2,
|   |   |-- 1603636018.RPi-18:2,
|   |   `-- 1612159655.RPi-18:2,
|   |-- new/
|   `-- tmp/
|-- /
|   |-- DRAFTS/
|   |   |-- cur/
|   |   |-- new/
|   |   `-- tmp/
|   |-- INBOX/
...
When I browse my mail (using the index or pager view in mutt), I can select, tag, delete, ... open the respective mail element which is read by mutt from the sketched folder structure. Now, I want to save the current message using mutt's save-message function. But beforehand (or after the save), I want to automatically extract the message's attachment and possibly do some other stuff using the mail contents. I already wrote a bash script which reads in the path of a mail file, e.g. ~/Mail//cur/1584016380.RPi-18:2 as its argument, and then stores the mail's attachments in a predefined location using the mu command. **PROBLEM** I have looked within the available mutt variables (folder, spoolfile, from, ...) in order to find anything that would tell me where my currently viewed mail file is actually located. But I could not find anything. So, I don't know which path to pass to my bash script for it to find the mail locally. **Is there anything usable, here?**
nnako (21 rep)
Sep 27, 2021, 12:58 PM • Last activity: Oct 25, 2021, 02:30 PM
7 votes
2 answers
2475 views
accessing Maildir locally with Mutt and remotely over IMAP simultaneously
I have `Postfix` + `Maildir` + `Dovecot` + `IMAP` on my mailserver. I am accessing my mailbox remotely over `IMAP` with one or more clients (Thunderbird). Additionally, on the server I have mutt configured for local (`Maildir`) access. When I am connected over `IMAP` with Thunderbird, and simultaneo...
I have Postfix + Maildir + Dovecot + IMAP on my mailserver. I am accessing my mailbox remotely over IMAP with one or more clients (Thunderbird). Additionally, on the server I have mutt configured for local (Maildir) access. When I am connected over IMAP with Thunderbird, and simultaneously start mutt locally on the server, Mutt seems to be confused. When I move a message in Thunderbird (over IMAP), Mutt notices something has changed and reports: Mailbox was externally modified. Flags may be wrong The problem seems to be one-sided. When I manipulate a message in Mutt, Thunderbird registers the change and has no problem with it. **Thus my question:** How can I make remote IMAP client and local Mutt client acccess Maildir without any conflicts/data corruption/errors? **Important:** I am looking for a solution where the Mutt access is local. For reasons beyond this discussion, I don't want Mutt to access the Maildir over IMAP. **Sidenote:** I don't understand why Mutt complains that mailbox was externally modified. After all, Postfix also modifies the mailbox when it delivers new emails.
user1968963 (4163 rep)
Jul 25, 2014, 09:10 PM • Last activity: Jan 5, 2021, 11:10 PM
2 votes
2 answers
914 views
How to get the notmuch message-id and thread-id from a maildir message filename already in the notmuch db?
Let's assume that I make a notmuch query that returns files: $ notmuch search --output=files tag:inbox from:love This returns a list of files, pointing to Maildir messages. Now I pick one of these files (already in the notmuch database), for instance with FILENAME=$(notmuch search --output=files tag...
Let's assume that I make a notmuch query that returns files: $ notmuch search --output=files tag:inbox from:love This returns a list of files, pointing to Maildir messages. Now I pick one of these files (already in the notmuch database), for instance with FILENAME=$(notmuch search --output=files tag:inbox from:love | fzf) and I would like to get its message-id and thread-id in the notmuch database. __From the variable $FILENAME, I would like to find the message-id in notmuch.__ A very sloppy way to do this is to parse the file, read the headers from/subject/date and make a notmuch query `notmuch search from:{...} subject:{...} date:{..}`. But since the filenames are already stored in the database, I guess there should be a canonical and robust way to obtain the mesage-id from the filename. Thanks!
jlewk (131 rep)
Aug 23, 2020, 08:38 PM • Last activity: Aug 26, 2020, 10:39 AM
6 votes
1 answers
1200 views
Synchronize IMAP to maildir folders - fast and complete solution with IDLE support?
This is likely to be borderline subjective, but I am searching for good alternatives for command line IMAP to maildir clients: Currently I am using `offlineimap`, but the docs are lacking, and support is vaning, what is a good alternative to `offlineimap` that has `IDLE` support, is fast and mature...
This is likely to be borderline subjective, but I am searching for good alternatives for command line IMAP to maildir clients: Currently I am using offlineimap, but the docs are lacking, and support is vaning, what is a good alternative to offlineimap that has IDLE support, is fast and mature (does not loose e-mails). Ideally it should synchronize maildir flags (and gmail labels, but can't get everything). I know of: * offlineimap * mbsync
gauteh (585 rep)
Mar 5, 2017, 02:19 PM • Last activity: Aug 26, 2020, 08:19 AM
1 votes
1 answers
91 views
Can mutt handle exclamation points instead of colons in file names?
I'm wanting to move my maildir folder to a different disk that has a Window file system. However, the file system does not allow colons (:) in file names, which Maildir uses in some file names by default. There is an option for Maildir to use another character in place of a colon. [Exclamation point...
I'm wanting to move my maildir folder to a different disk that has a Window file system. However, the file system does not allow colons (:) in file names, which Maildir uses in some file names by default. There is an option for Maildir to use another character in place of a colon. Exclamation point is common . However, I've read a warning that "you will probably loose compatibility with other programs trying to read the same Maildir. " when using this option. I only use mutt for reading this mail. Can mutt handle exclamation marks in place of a colon in filenames?
Rob Mosher (113 rep)
Aug 18, 2020, 01:43 PM • Last activity: Aug 19, 2020, 07:49 AM
4 votes
1 answers
1846 views
Change existing dovecot maildir installation from m-UTF7 charset to UTF8 to avoid breaking TAB
In an existing dovecot installation with many pre-existing folders using regional characters I would like to change m-UTF7 (`.&AMk-l&AOk-ments envoy&AOk-s`) foldernames to UTF8 (`.Éléments envoyés`). Among other reasons my main reason is folders like the above break TAB-completion nav...
In an existing dovecot installation with many pre-existing folders using regional characters I would like to change m-UTF7 (.&AMk-l&AOk-ments envoy&AOk-s) foldernames to UTF8 (.Éléments envoyés). Among other reasons my main reason is folders like the above break TAB-completion navigation in the shell for me. And the replacement names are much easier and pleasing to visually parse. Is there an integrated mechanism in dovecot facilitating the option change? Like: if maildirCharSetOption==UTF8 and CurrentFolder.instr('&') then SilentlyRenameFolderToUTF8(Currentfolder)` or similar? Or is the recommended way (and only way): * somehow create list of affected folders * use some scripting, awk and/or sed to * generate shell batch command file with lots of mv commands * check script output batch file for correctness * shutdown dovecot, postfix, * rerun script to get up2date folder list and process that into mv commands * run resulting batch script file * change dovecot config to "mail_location = maildir:/var/mail/%u:UTF-8=What " * start dovecot&postfix again From the documentation it is not clear, if I should use UTF-8=yes or true or 1, or just UTF-8 without =. I have a workable idea on how to accomplish the above, but was wondering, if there is a better way, or a finished script from someone who inherited a m-UTF7 installation before, and wants to share that. I think, there could be a way to suspend dovecot delivery temporarily instead of stopping dovecot, postfix, etc. And on first glance it looks like doveadm could be leveraged for translation instead of a manual translation table. It seems, m-UTF7 is the default. Why is that? Or, Are there reasons against using UTF-8 for folder names?
Alex Stragies (6144 rep)
May 28, 2016, 01:50 PM • Last activity: Sep 11, 2019, 09:15 PM
0 votes
0 answers
195 views
Is it normal for Postfix to store old messages in mbox when Maildir is active?
I noticed this output when testing my first Postfix installation: Saved 1 message in /home/USERNAME/mbox Held 1 message in /home/USERNAME/Maildir I have home_mailbox or whatever set to "Maildir/", so I was not expecting to see mbox anywhere after setting that up. Is this expected behavior or did I o...
I noticed this output when testing my first Postfix installation: Saved 1 message in /home/USERNAME/mbox Held 1 message in /home/USERNAME/Maildir I have home_mailbox or whatever set to "Maildir/", so I was not expecting to see mbox anywhere after setting that up. Is this expected behavior or did I overlooks something during the installation?
ineedhelp (101 rep)
Jul 8, 2019, 07:34 AM
1 votes
2 answers
268 views
Copy mail file from maildir over ssh
The maildir has a specific format of the files laying underneath, e.g. *1549464014.9224_427.hostname:2,RS*. In Debian environment copying this file over SSH without renaming is impossible or I don't know how. The question is how? **NOTE:** no renaming should be involved! The example output: [user@ho...
The maildir has a specific format of the files laying underneath, e.g. *1549464014.9224_427.hostname:2,RS*. In Debian environment copying this file over SSH without renaming is impossible or I don't know how. The question is how? **NOTE:** no renaming should be involved! The example output: [user@hostname ~]$ scp '1549464014.9224_427.hostname:2,RS' remote.server.com:/dest/dir/ 1549464014.9224_427.hostname:22: [Errno -2] Name or service not known The solution with quotation like in https://unix.stackexchange.com/questions/438791/scp-error-while-attempting-to-copy-files is not useful.
0andriy (124 rep)
Feb 6, 2019, 03:04 PM • Last activity: Feb 7, 2019, 08:49 PM
0 votes
2 answers
764 views
Bash scripting in a Maildir directory
I want to grep across 500 files in a Maildir directory. I issued the command grep MyPattern * I got the error message: bash: /usr/bin/grep: Argument list too long So I stored the list of files in a file MyFiles, and issued the following for i in $(`cat MyFiles`); do echo $i; done Before I did a grep...
I want to grep across 500 files in a Maildir directory. I issued the command grep MyPattern * I got the error message: bash: /usr/bin/grep: Argument list too long So I stored the list of files in a file MyFiles, and issued the following for i in $(cat MyFiles); do echo $i; done Before I did a grep, I wanted to do an echo just as a check. But this gave the following error bash: 1434361691.M617282P6399V0000000000000808I00000000000E16C1_23.ananda-linux,S=10055:2,S: command not found where that 1434... thing is the first file in the directory. So back to the original question. How do I grep across all these files in the mailbox. And I have larger mailboxes containing 50000 or more emails.
Sanjay Chakravarty (21 rep)
Apr 26, 2018, 08:02 AM • Last activity: Apr 26, 2018, 12:02 PM
1 votes
2 answers
2580 views
How do you use procmail mda to deliver files to be read by mh?
I'm using fetchmail to download email, and using procmail for delivery as the mda. I'd like them to be delivered for use with mh, but procmail seems to deliver them in a manner that mh doesn't understand: I get subdirectories new/ cur/ and tmp/ with files in new/ named something like 1484079635.6704...
I'm using fetchmail to download email, and using procmail for delivery as the mda. I'd like them to be delivered for use with mh, but procmail seems to deliver them in a manner that mh doesn't understand: I get subdirectories new/ cur/ and tmp/ with files in new/ named something like 1484079635.67044_0.HOSTNAME If I rename these files to just integers and move them up one directory, mh will pick them up fine. I'd like to be able to do this automatically, as well as to maintain the sequence from the last fetchmail run. fetchmail config: set logfile /path/to/fetchmail.log set no bouncemail poll "imap.gmail.com" protocol imap username "USER" password "PASSWORD" fetchall keep ssl mda "/path/to/procmail -m /path/to/.procmailrc" procmail config: LOGFILE=$HOME/procmail.log VERBOSE=on DELIVERED=yes MAILDIR=$HOME/Mail/. DEFAULT=inbox/
Angelo (2022 rep)
Jan 10, 2017, 08:51 PM • Last activity: Apr 18, 2018, 08:00 PM
Showing page 1 of 20 total questions