Internet address improvements

This commit is contained in:
M66B
2020-04-21 18:51:09 +02:00
parent 6c3114f013
commit e0c839e9a9
3 changed files with 15 additions and 45 deletions

View File

@@ -687,6 +687,7 @@ public class FragmentIdentity extends FragmentBase {
InternetAddress[] addresses = InternetAddress.parse(replyto);
if (addresses.length != 1)
throw new AddressException();
addresses[0].validate();
} catch (AddressException ex) {
throw new IllegalArgumentException(context.getString(R.string.title_email_invalid, replyto));
}
@@ -694,14 +695,16 @@ public class FragmentIdentity extends FragmentBase {
if (!TextUtils.isEmpty(cc) && !should)
try {
InternetAddress.parse(cc);
for (InternetAddress address : InternetAddress.parse(cc))
address.validate();
} catch (AddressException ex) {
throw new IllegalArgumentException(context.getString(R.string.title_email_invalid, cc));
}
if (!TextUtils.isEmpty(bcc) && !should)
try {
InternetAddress.parse(bcc);
for (InternetAddress address : InternetAddress.parse(bcc))
address.validate();
} catch (AddressException ex) {
throw new IllegalArgumentException(context.getString(R.string.title_email_invalid, bcc));
}