def METHOD_NAME(donation, received_now=False, domain_obj=None):
    payment = donation.payment
    if payment is None:
        return
    if not donation.completed:
        return
    if donation.recurring and not donation.first_recurring:
        # do not send email for recurring donations
        return
    pending_ok = payment.variant in ("lastschrift", "banktransfer", "sepa")
    confirmed = payment.status == PaymentStatus.CONFIRMED
    pending = payment.status in (PaymentStatus.PENDING, PaymentStatus.DEFERRED)
    if (confirmed and received_now and not pending_ok) or (pending and pending_ok):
        if not donation.email_sent:
            transaction.on_commit(lambda: send_donation_notification.delay(donation.id))
            send_donation_email(donation, domain_obj=domain_obj)