Why does cron use MTA to send emails, while we use MUA to send emails

cronemailimapmail-transport-agentsmtp

I have looked at the definitions of MTA, MUA, MDA, for example, https://ccm.net/contents/116-how-email-works-mta-mda-mua and https://en.wikipedia.org/wiki/Email_agent_(infrastructure)

  • In Lubuntu, the default email client is Sylpheed, and many also use Thunderbird. If I am correct, both Sylpheed and Thunderbird are MUA.

  • In https://unix.stackexchange.com/a/479613/674, Stephen mentioned that cron uses MTA (such as postfix or sendmail) to send the outputs of its jobs as emails.

My questions are:

  • Why does cron use MTA instead of MUA to send emails? If cron can use MUA to send emails, how?

  • why do we use MUA (Sylpheed or Thunderbird) instead of MTA to send emails? If we can use MTA to send emails, how?

  • When we install MUA (Sylpheed or Thunderbird) , does Sylpheed or Thunderbird need a MTA installed on the same machine to send emails?

Thanks.

Best Answer

At its base, mail on Unix is a local phenomenon. Users on the same host can mail each other without the existence of any network. (The "addresses" are simply usernames, with no @.) This of course means that the method of communicating a message from MUA to MTA must be local. Usually, that method is a pipe to a program named sendmail.

Purely local mail can be extended to participate in the Internet mail system by making the MTA understand addresses containing the @ symbol. The MUA still doesn't need to know about the existence of the network; it just needs to treat addresses as opaque strings and let the local MTA figure out which ones need to go over the network.

The MTA is obviously the right place for network configuration because there is only one of them on the system, but multiple MUAs can be in use by different users, or even the same user. A single program that handles the network stuff for all of them means the configuration doesn't need to be done more than once.

MUAs that inject their outgoing messages to a remote server are intended to allow "Unix-like" systems to pretend to work properly without an MTA. This configuration is a rejection of the traditional scheme of things. It cuts out the heart of the mail system - the ability to send a message to any local user - and provides no adequate replacement for it.

Cron is acting as an MUA, which is why it doesn't "use an MUA", and it's doing what Unix MUAs have always done, sending mail while having no idea that a network exists, relying on the local MTA to figure it out. And addressing the recipient by local username is the only reasonable default, since cron jobs run on behalf of a local user and there's no way of knowing what address that user might have on some remote host.

Related Question