[BlueOnyx:23960] Re: 5210R: Postfix SNI support + MailDir

Michael Stauber mstauber at blueonyx.it
Tue Jun 9 23:43:48 -05 2020


Hi Larry,

> On mine the 10-mail.conf change was:
> mail_location = maildir:~/Maildir:LAYOUT=fs:DIRNAME=MailDiR
> 
> and the procmailrc change was:
> ##ORGMAIL=$HOME/mbox
> ##DEFAULT=$ORGMAIL
> PATH=/usr/local/bin:/usr/bin:/bin
> 
> MAILDIR=$HOME/Maildir
> DEFAULT=$MAILDIR/INBOX/MailDiR/new
> LOGFILE=$MAILDIR/log
> 
> 
> Which is really not 100% correct because it ends up putting all the
> mail one level deeper (Maildir/INBOX/MailDiR/) than it should be
> but by the time I got it working I was too frustrated to go back and
> change it.

Ah, I see. Here is what worked for me:

[root at jarvis ~]# cat /etc/procmailrc
ORGMAIL=$HOME/Maildir/
DEFAULT=$ORGMAIL
MAILDIR=$ORGMAIL

[root at jarvis ~]# cat /etc/dovecot/conf.d/10-mail.conf|grep ^mail
mail_location = maildir:~/Maildir:LAYOUT=fs

So I now have that sorted for 5210R and the result is in the BlueOnyx
"5210R-testing" YUM repository. Attached is a screenshot of the new
"Network Services" / "Email" GUI page.

As you can see there:

The Email server is configurable: Sendmail (default) or Postfix.

You can set the "Mailbox Format": Mbox (default) or Maildir.

Additionally there is a checkbox "Convert Mailboxes". If ticked, it'll
run a conversion of all mailboxes that currently have emails. It'll
convert *to* the format that's chosen under "Mailbox Format" after you save.

So you can change the format, save and then can go back later and can
convert. Or you can change the format *and* tick the checkbox to convert
the mailboxes and save only once.

HOWEVER: The mouse-over helptext makes it clear that this is risky, that
it can fail and that the recommended way is to do the conversion of
mailboxes from the Shell in SSH as "root" via this little tool:

[root at jarvis 5210R-Postfix]# /usr/sausalito/sbin/mbox_maildir_convert.pl
┌──────────────────────────────────────────────────────────────┐
│ BlueOnyx Mbox/Maildir & Maildir/Mbox converter               │
└──────────────────────────────────────────────────────────────┘

usage:     /usr/sausalito/sbin/mbox_maildir_convert.pl [OPTIONS]

Example: /usr/sausalito/sbin/mbox_maildir_convert.pl --mbox
Example: /usr/sausalito/sbin/mbox_maildir_convert.pl --maildir

       --mbox     Converts all mailboxes to mbox format
       --maildir  Converts all mailboxes to maildir format
       -h|--help  This help text

That will do the trick quite nicely.

Additionally "base-blueonyx" has been updated with provisions that once
the mailbox format has been set and /etc/sysconfig/bxmbox is present,
then /etc/procmailrc will not be messed with anymore during YUM updates.

Code changes for the Mailbox feature:

https://devel.blueonyx.it/trac/changeset?reponame=&new=3877%40BlueOnyx%2F5210R-Postfix&old=3872%40BlueOnyx%2F5210R-Postfix

And here is the code for /usr/sausalito/sbin/mbox_maildir_convert.pl:

https://devel.blueonyx.it/trac/browser/BlueOnyx/5210R-Postfix/ui/base-system.mod/src/blueonyx-mailbox-converter/mbox_maildir_convert.pl?rev=3873

For mbox to maildir conversions it makes a call to
/usr/sausalito/sbin/mb2md.pl (it's inlcuded).

For maildir to mbox conversions I hacked something together based on a
few code-snippets that I found elsewhere.

It basically checks /Maildir for subdirectories containing 'cur' and
'new' subdirectories. If it finds emails in them, then it escapes single
quotes and cobbles it all into a new mbox file.

When you DO a conversion and a target "mbox" or "Maildir" are already
present? Then they will be renamed and that backup is then left alone.

-- 
With best regards

Michael Stauber
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 5210R-Email.png
Type: image/png
Size: 166378 bytes
Desc: not available
URL: <http://mail.blueonyx.it/pipermail/blueonyx/attachments/20200609/8ff03131/attachment-0001.png>


More information about the Blueonyx mailing list