mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-07 23:16:37 +00:00
Improved address validation
This commit is contained in:
parent
04c8b05f87
commit
cd005043b4
1 changed files with 12 additions and 9 deletions
|
@ -3849,6 +3849,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
InternetAddress[] acc = (TextUtils.isEmpty(cc) ? null : InternetAddress.parse(cc));
|
||||
InternetAddress[] abcc = (TextUtils.isEmpty(bcc) ? null : InternetAddress.parse(bcc));
|
||||
|
||||
// Safe guard
|
||||
if (action == R.id.action_send) {
|
||||
checkAddress(ato, context);
|
||||
checkAddress(acc, context);
|
||||
|
@ -4337,16 +4338,18 @@ public class FragmentCompose extends FragmentBase {
|
|||
if (addresses == null)
|
||||
return;
|
||||
|
||||
try {
|
||||
for (InternetAddress address : addresses)
|
||||
for (InternetAddress address : addresses) {
|
||||
Address[] _addresses = new Address[]{address};
|
||||
try {
|
||||
address.validate();
|
||||
if (lookup_mx)
|
||||
DnsHelper.checkMx(context, addresses);
|
||||
} catch (AddressException ex) {
|
||||
throw new AddressException(context.getString(R.string.title_address_parse_error,
|
||||
MessageHelper.formatAddressesCompose(addresses), ex.getMessage()));
|
||||
} catch (UnknownHostException ex) {
|
||||
throw new AddressException(ex.getMessage());
|
||||
if (lookup_mx)
|
||||
DnsHelper.checkMx(context, _addresses);
|
||||
} catch (AddressException ex) {
|
||||
throw new AddressException(context.getString(R.string.title_address_parse_error,
|
||||
MessageHelper.formatAddressesCompose(_addresses), ex.getMessage()));
|
||||
} catch (UnknownHostException ex) {
|
||||
throw new AddressException(ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue