def METHOD_NAME(sender):
    wildcard_senders = [s for s in flask.current_app.config.get('WILDCARD_SENDERS', '').lower().replace(' ', '').split(',') if s]
    localpart, domain_name = models.Email.resolve_domain(sender)
    if localpart is None:
        return flask.jsonify(",".join(wildcard_senders)) if wildcard_senders else flask.abort(404)
    localpart = localpart[:next((i for i, ch in enumerate(localpart) if ch in flask.current_app.config.get('RECIPIENT_DELIMITER')), None)]
    destinations = set(models.Email.resolve_destination(localpart, domain_name, True) or [])
    destinations.update(wildcard_senders)
    destinations.update(i[0] for i in models.User.query.filter_by(allow_spoofing=True).with_entities(models.User.email).all())
    if destinations:
        return flask.jsonify(",".join(idna_encode(destinations)))
    return flask.abort(404)