Regarding the local mail sent by cron via sendmail

Asked 2 years ago, Updated 2 years ago, 110 views

The default settings on the local mac or amazon linux are to send mail to the cron executable via the sendmail command when the cron fails to execute.(And each user can check the contents of the mail by using the mailx command.)

There have been some questions about this behavior of "sending mail to local users," and perhaps a series of knowledge, I have not been able to find the source information.specifically:

  • If sendmail sends mail to local users, it will be like loading data sent so far and appending new mail sent to the end of the mail storage directory file format for local users. Is this mail storage directory file format named?
    • Specifically, it will be saved in /var/mail/username. Is there a name in this file format and storage location convention?
  • I think the above mail storage directory file format for local users is probably used not only for local mail but also for receiving mail from external servers. Is this understanding correct?
    • Or is this directory used only for "local user-to-user mail"?
    • In that case, this "local user-to-user mail reception" itself seems to have a protocol name. Do you have that name?
  • Specifically, it will be saved in /var/mail/username. Is there a name in this file format and storage location convention?
  • Or is this directory used only for "local user-to-user mail"?
  • In that case, this "local user-to-user mail reception" itself seems to have a protocol name. Do you have that name?

unix mail sendmail

2022-09-30 14:29

3 Answers

Part of the directory structure determined by FHS.

Although it may vary by distribution, /var/mail is usually a symbolic link to /var/spool/mail, and /var/spool is used as a place to store "queues" such as mail and print jobs.

Learn the role of each directory (subdirectory edition): Linux common sense (3) to teach Windows users - @IT

/var/spool
Spool is an abbreviation for Simultaneous Peripheral Operation On-Line, originally an IBM term.It is originally a buffer for efficient data transmission to slow peripherals.In other words, it appears to be used as a buffer for FIFO (First In First Out) called a "queue."

(omitted)

Also, for mail servers using sendmail, there is the same file as each user name under /var/spool/mail.This is what we call a mailbox.Any mail sent to the user will be saved here.After that, you can read it with the mail command or read it into the mailer with POP3.Recently, some servers seem to use qmail as an MTA, but in that case, it is common to send mail directly to each user's home directory without using /var/spool/mail.


2022-09-30 14:29

Does the mail storage directory file format for local users have a name?

yes.

It is referred to as the "mbox format.mbox-Wikipedia

Another option is Maildir format, which is saved as a single mail file.Maildir-Wikipedia

For example, Postfix has options such as mbox or Maildir.Postfix configuration parameters

"The ""local user's mail storage directory file format"" is also used to receive mail from an external server."

yes.


2022-09-30 14:29

I'm not sure if there is a fixed term in the saved directory (/var/mail or /var/spool/mail), but I think it's commonly called a mail spool directory.The file format there is called mbox.Some MTAs also allow you to create mbox-formatted files in your home directory without placing them in a common spool directory.

In addition to the mbox format, there is also Maildir

It is typically used for both local distribution and external reception.


2022-09-30 14:29

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.