BTW, although testing validity of email would indeed be nice,
it is notoriously difficult. For example, this is valid:
http://@jhnc.org;
( https://www.rfc-editor.org/rfc/rfc5322#section-3.4 )
but I believe fails the regex in your link (I can't test properly
without turning off my adblocker, which I don't intend to do).
The safe_p() function could perhaps be generalised to recognise
a list of valid addresses separated by `\s*,\s*` but beyond that
it is almost certainly, as you say: "asking a program to be more
clever than its users is a waste of energy".
My concern is that whatever checks are done, they get done at save,
so any "errors" are caught early.
-jonathan
georges.khaznadar wrote:
> To: [email protected], [email protected]
> From: Khaznadar Georges <[email protected]>
> Date: Tue, 27 Feb 2024 09:57:39 +0100 (CET)
> Subject: Re: cron: "crontab -e" does not report "unsafe" mail and so job
> output can be lost
> X-Mailer: Open-Xchange Mailer v7.6.3-Rev71
>
> Hello Jonathan,
>
> I apologize, I had not paid attention to the extra space included in the
>
> list of MAILTO addresses.
>
> I suppose that we can sanitize the value of MAILTO, by checking it
>
> with a regular expression derived from RFC 5322 Official Standard
>
> (see [1]https://emailregex.com/), or do you suggest some lighter approach?
>
> Best regards, Georges.
>
> Jonathan H N Chin a écrit :
> > Sorry, my mail server does not seem to have received any email
> > from debian when you sent your email on 2024-01-21. Was I
> > supposed to have been automatically Bcc'd?
> >
> > I disagree that the bug is not grave – I believe it meets the
> > criterion of data being lost (and was in fact lost by the user).
> > However, that does not really bother me.
> >
> > Note that I used quotation marks around the word unsafe because
> > that is the wording used in the syslog message; the addresses are
> > not unsafe. The problem is the space character.
>
> References
>
> Visible links
> 1. https://emailregex.com/