2

just making my very first steps with mail on Ubuntu. Followed This guide

But when I try to initialise my mailbox with

echo 'init' | mail -s 'init' -Snorecord sammy

I get the "would be" expected response

Can't canonicalize "/home/user/Maildir

However, once I do

ls -R ~/Maildir

I get nothing in response. I.e. my maildir is not being created and Maildir not initialised.

What to look for? How can I troubleshoot/debug this?

1
  • have you managed to fix it? I'm suck there too ...
    – sebpiq
    Commented Apr 15, 2017 at 7:42

4 Answers 4

2

I was having the exact same issue but fixed this by doing the following:

  1. opening my postfix main.cf file:
sudo nano /etc/postfix/main.cf

and adding the following to the end of the file:

home_mailbox = Maildir/

and restarting postfix.

sudo /etc/init.d/postfix reload
sudo systemctl restart postfix

At that point running

echo 'init' | mail -s 'init' -Snorecord my_username

returned

Can't canonicalize "/home/my_username/Maildir"

but when I ran

ls -R ~/Maildir

The mail directory was there!! Success!!

Apparently, when you change parameter home_mailbox in postfix, you need to adjust the configuration so it will search mail in new location. With home_mailbox = Maildir/, postfix will store the email in Maildir directory relative with user home directory.

Hope this helps future mail pioneers.

1

I just encountered this problem, and after messing around with Google, I found this.

$ sudo postmap /etc/postfix/virtual
$ sudo service postfix reload

Solved the problem!

0

Try this method posted earlier. The Directory error is gone but still not getting mail. mail(1) isn't able to open Maildir mailbox

Update 1: I tried creating a new user after this, and it seemed to work. The files are showing up. Maybe it is a permissions issue. If I figure it out, I'll update this post.

Update 2: Recreate these commands (Source) and post what you see.

Install mailx package for use as command mail utility program. Mail command is installed with this package.

sudo apt-get install mailutils

Add a user before you start this.

sudo useradd -m -s /bin/bash fmaster
sudo passwd fmaster

Test your default installation using the following code segment.

telnet localhost 25

(if that doesn't work, check to see if postfix is running)

sudo postfix status

If it is not running, start it

sudo postfix start

Postfix will prompt like following in the terminal so that you can use to type SMTP commands.

Trying 127.0.0.1...
Connected to mail.fossedu.org.
Escape character is '^]'.
220 localhost.localdomain ESMTP Postfix (Ubuntu)

Type the following code segment in Postfix's prompt.

ehlo localhost
mail from: root@localhost
rcpt to: fmaster@localhost
data
Subject: My first mail on Postfix

Hi,
Are you there?
regards,
Admin
.  # (Type the .[dot] in a new Line and press Enter )
quit

Check the mailbox of fmaster

su - fmaster
mail

When you type mail command an output like follows display in your terminal.

Mail version 8.1.2 01/15/2001.  Type ? for help.
"**/var/mail/fmaster**": 2 messages 2 new
>N  1 root@localhost     Mon Mar  6 12:49   13/479   Just a test
 N  2 root@localhost     Mon Mar  6 12:51   15/487   My first mail
&

If you see the following line: /var/mail/fmaster type:

sudo postconf -e "home_mailbox = Maildir/"

Repeat steps and see that your folder has changed to /home/fmaster/Maildir

0

in this code:

echo 'init' | mail -s 'init' -Snorecord sammy

try:

echo 'init' | mail -s 'init' -snorecord sammy

I tried to change the uppercase -S to lowercase -s

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .