From 7c83aeb73422262150b73a79c7fe51d186fd088a Mon Sep 17 00:00:00 2001 From: isaacclad Date: Thu, 16 Jul 2026 12:01:29 +0000 Subject: [PATCH] fix(email): use client/org name as From display, not Ladill product Customer-facing outbound mail should appear from the business (organizer, clinic, company, location), not the Ladill product brand. --- app/Mail/ContactMessageMail.php | 7 +++++++ app/Services/Comms/EmailService.php | 4 +++- app/Services/Meet/MeetNotificationService.php | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/Mail/ContactMessageMail.php b/app/Mail/ContactMessageMail.php index 842ccad..d111ebe 100644 --- a/app/Mail/ContactMessageMail.php +++ b/app/Mail/ContactMessageMail.php @@ -4,6 +4,7 @@ namespace App\Mail; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; +use Illuminate\Mail\Mailables\Address; use Illuminate\Mail\Mailables\Content; use Illuminate\Mail\Mailables\Envelope; use Illuminate\Queue\SerializesModels; @@ -23,7 +24,13 @@ class ContactMessageMail extends Mailable public function envelope(): Envelope { + $display = trim((string) ($this->fromName ?: $this->companyName)); + $fromAddress = (string) config('mail.from.address'); + return new Envelope( + from: $display !== '' && $fromAddress !== '' + ? new Address($fromAddress, $display) + : null, subject: $this->subjectLine, replyTo: $this->replyToAddress ? [$this->replyToAddress] : [], ); diff --git a/app/Services/Comms/EmailService.php b/app/Services/Comms/EmailService.php index fc89c94..0202961 100644 --- a/app/Services/Comms/EmailService.php +++ b/app/Services/Comms/EmailService.php @@ -27,9 +27,11 @@ class EmailService $logoUrl = OrganizationBranding::emailLogoUrl($organization); $companyName = $organization->name; } + // Client-facing From display: org/company name, never the Ladill product brand. + $displayName = trim((string) ($fromName ?: $companyName)) ?: null; try { - Mail::to($to)->send(new ContactMessageMail($subject, $body, $fromName, $replyTo, $logoUrl, $companyName)); + Mail::to($to)->send(new ContactMessageMail($subject, $body, $displayName, $replyTo, $logoUrl, $companyName)); return true; } catch (\Throwable $e) { diff --git a/app/Services/Meet/MeetNotificationService.php b/app/Services/Meet/MeetNotificationService.php index f6fd987..d95e8f7 100644 --- a/app/Services/Meet/MeetNotificationService.php +++ b/app/Services/Meet/MeetNotificationService.php @@ -135,8 +135,11 @@ class MeetNotificationService ? $room->scheduled_at->timezone($room->timezone)->format('M j, Y g:i A T') : 'Instant meeting'; + $orgName = trim((string) ($room->organization?->name ?? '')); + $sessionLabel = $orgName !== '' ? $orgName.' meeting' : 'video meeting'; + $lines = [ - $host->name.' invited you to a Ladill Meet session.', + $host->name.' invited you to a '.$sessionLabel.'.', '', 'Meeting: '.$room->title, 'When: '.$when,