+ #technically \w and also ! # $ % & ' * + - / = ? ^ _ ` { | } ~
+ # and even more technically need to deal with i18n addreesses soon
+ # (maybe the UI can convert them for us ala punycode.js)
+ # but for now in practice have not encountered anything outside \w . - & + '
+ # and even & and ' are super rare and probably have scarier "pass to shell"
+ # implications than worth being pedantic about accepting
+ # (we always String::ShellQuote quote them, but once passed...)
+ # SO: \w . - +
+ if ( $self->emailaddress =~ /^\s*([\w\.\-\+]+)\@(([\w\.\-]+\.)+\w+)\s*$/ ) {
+ my($user, $domain) = ($1, $2);
+ $self->emailaddress("$1\@$2");
+ } else {
+ return gettext("illegal_email_invoice_address"). ': '. $self->emailaddress;
+ }
+