Skip to main content
added 499 characters in body
Source Link
Binarus
  • 3.9k
  • 4
  • 22
  • 49

[ Update per 2021-10-20:

As outlined in my comment to your original question from 2021-10-20, there is an alternative way around the problem which saves you from recompiling: Move the "real" sendmail elsewhere and install the scripts in its place. Then, whenever the script is executed, make it figure out who called it. If cron has called it, make it behave as shown above; if not, make it call the "real" sendmail with the same stdin and parameters, i.e. "relay" stdin and the parameters to the "real" sendmail.

]

Another problem is that you don't see only the error messages you're interested in, but each time see the whole raw email message cron would send, including the headers. The remedy would be to add some code to our script which filters out the lines you are not interested in, e.g. using grep, sed and their friends. But this also is outside the scope of this question.

Another problem is that you don't see only the error messages you're interested in, but each time see the whole raw email message cron would send, including the headers. The remedy would be to add some code to our script which filters out the lines you are not interested in, e.g. using grep, sed and their friends. But this also is outside the scope of this question.

[ Update per 2021-10-20:

As outlined in my comment to your original question from 2021-10-20, there is an alternative way around the problem which saves you from recompiling: Move the "real" sendmail elsewhere and install the scripts in its place. Then, whenever the script is executed, make it figure out who called it. If cron has called it, make it behave as shown above; if not, make it call the "real" sendmail with the same stdin and parameters, i.e. "relay" stdin and the parameters to the "real" sendmail.

]

Another problem is that you don't see only the error messages you're interested in, but each time see the whole raw email message cron would send, including the headers. The remedy would be to add some code to our script which filters out the lines you are not interested in, e.g. using grep, sed and their friends. But this also is outside the scope of this question.

Bounty Awarded with 500 reputation awarded by Martin Vegter
deleted 110 characters in body
Source Link
Binarus
  • 3.9k
  • 4
  • 22
  • 49

Historically, SENDMAIL was the predominant MTA for a while. SENDMAIL iscontains not only an MTA, but also an MSP (message submission program). The daemon part as well as the MSP part are bothis implemented in /usr/sbin/sendmail. Which role it takes when executed depends on the command line switches.

Anyway, forFor a long time, nobody got away without SENDMAIL, and therefore many applications still literally rely on /usr/sbin/sendmail or at least sendmail to be usable as mail submission program. This is the reason that even SENDMAIL's competitors like POSTFIX still also provide that program as a compatibility wrapper.

Historically, SENDMAIL was the predominant MTA for a while. SENDMAIL is not only an MTA, but also an MSP (message submission program). The daemon part as well as the MSP part are both implemented in /usr/sbin/sendmail. Which role it takes when executed depends on the command line switches.

Anyway, for a long time, nobody got away without SENDMAIL, and therefore many applications still literally rely on /usr/sbin/sendmail or at least sendmail to be usable as mail submission program. This is the reason that even SENDMAIL's competitors like POSTFIX still also provide that program as a compatibility wrapper.

Historically, SENDMAIL was the predominant MTA for a while. SENDMAIL contains not only an MTA, but also an MSP (message submission program). The MSP part is implemented in /usr/sbin/sendmail. For a long time, nobody got away without SENDMAIL, and therefore many applications still literally rely on /usr/sbin/sendmail or at least sendmail to be usable as mail submission program. This is the reason that even SENDMAIL's competitors like POSTFIX still also provide that program as a compatibility wrapper.

added 59 characters in body
Source Link
Binarus
  • 3.9k
  • 4
  • 22
  • 49

So I just had to replace /usr/sbin/sendmail by the script shown above (since I have an MTA installed, this was just for testing). cron calls /usr/sbin/sendmail when it tries to send mail, and this now is our script. The script just takes its standard input and redirects it to the file.

So I just had to replace /usr/sbin/sendmail by the script shown above. cron calls /usr/sbin/sendmail when it tries to send mail, and this now is our script. The script just takes its standard input and redirects it to the file.

So I just had to replace /usr/sbin/sendmail by the script shown above (since I have an MTA installed, this was just for testing). cron calls /usr/sbin/sendmail when it tries to send mail, and this now is our script. The script just takes its standard input and redirects it to the file.

added 1764 characters in body
Source Link
Binarus
  • 3.9k
  • 4
  • 22
  • 49
Loading
added 1764 characters in body
Source Link
Binarus
  • 3.9k
  • 4
  • 22
  • 49
Loading
added 1764 characters in body
Source Link
Binarus
  • 3.9k
  • 4
  • 22
  • 49
Loading
added 1764 characters in body
Source Link
Binarus
  • 3.9k
  • 4
  • 22
  • 49
Loading
added 1764 characters in body
Source Link
Binarus
  • 3.9k
  • 4
  • 22
  • 49
Loading
Source Link
Binarus
  • 3.9k
  • 4
  • 22
  • 49
Loading