Use default From address if no data provided
Currently we (accidentally?) force users to provide a From Name and a From Email.
This merge request changes that such that if both those are missing, the site default is used.
It looks like the code was designed to do this (there was code to fetch the default), but it used isset()
on the params array, which will have caused problems:
- blank items, e.g. from the CiviRule action would be true for isset and cause invalid From address errros.
- The CiviRule action always provides the params, even if no data was entered, so the default could never be used.
This MR changes that to use !empty()
- so if you provide blank params, the default is used.
Aside: I might raise a separate issue over the fact that the API requires both name and email - I'm not sure why. I can think of many cases where you'd want to leave the default in place, e.g. the default name might be an organisation's name, but you need an email to come from a different mailbox. Or vice versa: you want to customise the From name but keep the default email.