fix(care): use clinic name as email From display, not Ladill Care
Deploy Ladill Care / deploy (push) Successful in 28s

Patient-facing suite (and Bird fallback) emails should appear from the
organization name. Stop defaulting from_name to CARE_SMTP_FROM_NAME.
Appointment notifications also prefer suite messaging with the same rule.
This commit is contained in:
isaacclad
2026-07-16 11:58:24 +00:00
parent 2a00d4321b
commit f7baa6ebf0
4 changed files with 79 additions and 33 deletions
@@ -42,13 +42,22 @@ class PatientMessageController extends Controller
$owner = $this->ownerRef($request);
$organization = $this->organization($request);
$html = OrganizationBranding::wrapEmailHtml(nl2br(e($data['body'])), $organization);
// Patient-facing From display name is the clinic/company, never the Ladill product.
$fromName = trim((string) $organization->name) ?: null;
$sent = false;
$error = null;
$via = null;
if ($platformEmail->isConfigured()) {
$sent = $platformEmail->send($owner, (string) $patient->email, $data['subject'], $html, $data['body']);
$sent = $platformEmail->send(
$owner,
(string) $patient->email,
$data['subject'],
$html,
$data['body'],
$fromName,
);
$via = 'suite';
if (! $sent) {
$error = $platformEmail->lastError();
@@ -61,7 +70,7 @@ class PatientMessageController extends Controller
$sent = $email->send(
$apiKey,
(string) $credential->bird_from_email,
$credential->bird_from_name,
$credential->bird_from_name ?: $fromName,
(string) $patient->email,
$data['subject'],
$html,