# bash, mailx and maildir

## dju`

Hi,

does mailx support maildirs ? i have mail waiting in ~/.maildir/new/ but i get a "No mail for me" when i enter "mail".

does bash's mail checking support maildirs ? I have exported MAILPATH=~/.maildir/ but no new mail notification appears.

Thanks

----------

## jkcunningham

I don't know if mailx supports maildir format or not. If it doesn't, mutt does. I don't believe bash has anything to do with mail, other than being the owner of environment variables. You need some notification app running, like biff, that watches a folder for activitiy. 

According to this site:

http://www.mkssoftware.com/docs/man1/mailx.1.asp#ENVIRONMENT_VARIABLES

you aren't using the right environment variable for mailx. Try setting MAILDIR in your .bashrc. to "~/.maildir/" (some mail apps need the trailing slash to tell them it is in maildir format). 

If that doesn't work, what is delivering the mail to ~/.maildir now? Tell it to use mbox format (the only format mentioned in the doc mentioned above on mailx). 

-Jeff

----------

## dju`

it seems that mailx doesn't work with maildir, your solution doesn't work.

according to the bash manual, bash can check mail :

```
MAILCHECK

    How often (in seconds) that the shell should check for mail in the files specified in the MAILPATH or MAIL variables. The default is 60 seconds. When it is time to check for mail, the shell does so before displaying the primary prompt. If this variable is unset, or set to a value that is not a number greater than or equal to zero, the shell disables mail checking.
```

so there's no need to use biff or similar. furthermore, i believe that biff isn't in portage.

----------

## jkcunningham

Interesting. I didn't know that about bash. But it seems your problem is trying to use maildir format with mailx which doesn't support it. You probably need to make your mail delivery agent deliver in mbox format which mailx does understand (or switch mail client to something like mutt which supports all of them). 

Have fun.

-Jeff

----------

## snowpatch

I have postfix setup as per the howto, with mail going to ~/.maildir/ for each user. While it is true that using 

```
mail
```

 to check for mail doesn't work with maildir format, I can send mail to another user with the mail command. I just use mutt to read it.

----------

## riscycdj

I have the same situation. But I can't seem to work out what to put in .bashrc to get the mail checking to work. Mailx doesn't work with maildir so I am going to unmerge it. Mutt works fine.

I just can't get the mail notification in bash working.

----------

## shaman200

Just in case you really like mailx:

1/emerge -C mailx (yeah, i know  :Laughing:  )

2/emerge nail

here's an excerpt of the install:

>>> /usr/bin/nail

>>> /usr/bin/mailx -> /usr/bin/nail

>>> /usr/bin/mail -> /usr/bin/nail

>>> /usr/bin/Mail -> /usr/bin/nail

so you don't have to change your ways....

3/Be sure that the MAIL variable is set correctly

Linuxboxx:/home/user >>env|grep -i mail

MAIL=/home/user/.maildir

NOW, it's working just right   :Razz: 

----------

## Merlin8000

worked great for me, thanks, my curiosity about doing this just now reached a level high enough to seek out an answer

There should really be something in the courier/postfix/maidir wiki pages about this

----------

