Improved address validation

pull/178/head
M66B 5 years ago
parent 04c8b05f87
commit cd005043b4

@ -3849,6 +3849,7 @@ public class FragmentCompose extends FragmentBase {
InternetAddress[] acc = (TextUtils.isEmpty(cc) ? null : InternetAddress.parse(cc)); InternetAddress[] acc = (TextUtils.isEmpty(cc) ? null : InternetAddress.parse(cc));
InternetAddress[] abcc = (TextUtils.isEmpty(bcc) ? null : InternetAddress.parse(bcc)); InternetAddress[] abcc = (TextUtils.isEmpty(bcc) ? null : InternetAddress.parse(bcc));
// Safe guard
if (action == R.id.action_send) { if (action == R.id.action_send) {
checkAddress(ato, context); checkAddress(ato, context);
checkAddress(acc, context); checkAddress(acc, context);
@ -4337,18 +4338,20 @@ public class FragmentCompose extends FragmentBase {
if (addresses == null) if (addresses == null)
return; return;
for (InternetAddress address : addresses) {
Address[] _addresses = new Address[]{address};
try { try {
for (InternetAddress address : addresses)
address.validate(); address.validate();
if (lookup_mx) if (lookup_mx)
DnsHelper.checkMx(context, addresses); DnsHelper.checkMx(context, _addresses);
} catch (AddressException ex) { } catch (AddressException ex) {
throw new AddressException(context.getString(R.string.title_address_parse_error, throw new AddressException(context.getString(R.string.title_address_parse_error,
MessageHelper.formatAddressesCompose(addresses), ex.getMessage())); MessageHelper.formatAddressesCompose(_addresses), ex.getMessage()));
} catch (UnknownHostException ex) { } catch (UnknownHostException ex) {
throw new AddressException(ex.getMessage()); throw new AddressException(ex.getMessage());
} }
} }
}
}; };
private static String unprefix(String subject, String prefix) { private static String unprefix(String subject, String prefix) {

Loading…
Cancel
Save