I need to validate several email addresses in my perl template, on sme server I use to validate them by esmith::util::isValidEmail but on nethserver it has been removed
I can use perl-Email-Valid from epel for this purpose but I prefer to use a solution already installed.
For those who want to know why I didn’t validate it in Nethgui, I use a ‘textArea’ because I want to save several addresses (one address per line) and the available validators cannot work with this type of box. I suppose that kind of validator are workable for the ‘textInput’.
The default installation already has perl-Mail-RFC822-Address package.
From the official doc (tested, it works with single quotes)
use Mail::RFC822::Address qw(valid validlist);
if (valid("pdw@ex-parrot.com")) {
print "That's a valid address\n";
}
if (validlist("pdw@ex-parrot.com, other@elsewhere.com")) {
print "That's a valid list of addresses\n";
}