Email - Mailbox

About

A mailbox is a file where the emails message are stored. It can be real or virtual and is managed through a client (mua)

Management

List

The default in post fix is /var/mail or /var/spool/mail. See mail_spool_directory

sudo ls /var/mail
  • Two mailbox
root  user

Set the path

The MAIL environment variable set the path of the mailbox.

Example:

MAIL=/var/spool/mail/nico

Content

UNIX mailboxes: A mailbox file is just a collection of text mail separated by --multipart-boundary--

(See also Mbox format (JavaMail can read them))

Example:

--multipart-boundary--

From [email protected]  Wed Jun 10 03:10:08 2020
Return-Path: <[email protected]>
Received: from example.com (localhost [127.0.0.1])
	by example.com (8.14.7/8.14.7) with ESMTP id 05A1A7A9005523
	for <[email protected]>; Wed, 10 Jun 2020 03:10:07 +0200
Received: (from [email protected])
	by example.com (8.14.7/8.14.7/Submit) id 05A1A7dG005522
	for root; Wed, 10 Jun 2020 03:10:07 +0200
Date: Wed, 10 Jun 2020 03:10:07 +0200
Message-Id: <[email protected]>
From: Anacron <[email protected]>
To: [email protected]
Content-Type: text/plain; charset="UTF-8"
Subject: Anacron job 'cron.daily' on example.com

/etc/cron.daily/logrotate:

error: skipping "/var/log/php-fpm/error.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
error: skipping "/var/log/php-fpm/www-error.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.

Delete

With mail client utility

Example on how to to delete the mail 1 to 15 with mailx

mail
d 1-15
quit

Powered by ComboStrap