Contribution Pay Later Invoice sent "To:" On-Behalf-Of Organization rather than Contributor
When a contributor makes a "pay later" donation "On Behalf Of" an organization (for example, they need an invoice sent to generate funds, they need to send a physical check, etc), the "receipt/invoice" email is sent "To:" the Organization's email address instead of the contributor.
The contributor is CC'd, but plenty of times the organization is new (being created in that form with no email address in the on-behalf-of profile), or the organization selected has no email address recorded... so no receipt/invoice email is sent at all.
This is problematic because the thank-you page states the email confirmation goes to the contributor, and the contributor will not receive essential information to complete the on-behalf-of donation.
Reproduced on 5.26.alpha1
- Create a donation page with "on behalf of" and "pay later" both enabled
- Disable the email field in the default "on behalf of" profile
- Go through an "on behalf of" form submit with "pay later"
- Observe statement that instructions will be sent to the contributors email address
- Observe no receipt/invoice email sent
Currently, on-behalf-of receipts are sent "To:" the organization email address, and CC'd to the contributor email address. If there is no organization email address for whatever reason, no invoice is sent.
I would expect the receipt/invoice to be sent to the contributor no matter what. We could get at this in a variety of ways:
- Switch the targets around so "To:" is always the contributor and "CC" is the on-behalf-of organization
- Switch the target so "To:" is the contributor only if "To:" is empty
- Fire off two emails, one "To:" each contact involved if there is a "related_contact" in the form, getting rid of the CC all together
I would probably opt for 3 - but I don't know all of the context of the CC here.
EDIT: Here is an example of what option 3 might look like: https://github.com/civicrm/civicrm-core/pull/17185