Use organization logo in Meet outbound emails.
Deploy Ladill Meet / deploy (push) Successful in 1m28s
Deploy Ladill Meet / deploy (push) Successful in 1m28s
Replace the product email mark with company logo or name in contact-message mail. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -17,6 +17,8 @@ class ContactMessageMail extends Mailable
|
||||
public string $bodyText,
|
||||
public ?string $fromName = null,
|
||||
public ?string $replyToAddress = null,
|
||||
public ?string $logoUrl = null,
|
||||
public ?string $companyName = null,
|
||||
) {}
|
||||
|
||||
public function envelope(): Envelope
|
||||
@@ -34,6 +36,8 @@ class ContactMessageMail extends Mailable
|
||||
with: [
|
||||
'bodyText' => $this->bodyText,
|
||||
'fromName' => $this->fromName,
|
||||
'logoUrl' => $this->logoUrl,
|
||||
'companyName' => $this->companyName,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace App\Services\Comms;
|
||||
|
||||
use App\Mail\ContactMessageMail;
|
||||
use App\Models\Organization;
|
||||
use App\Support\OrganizationBranding;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
@@ -13,14 +15,21 @@ use Illuminate\Support\Facades\Mail;
|
||||
*/
|
||||
class EmailService
|
||||
{
|
||||
public function send(string $to, string $subject, string $body, ?string $fromName = null, ?string $replyTo = null): bool
|
||||
public function send(string $to, string $subject, string $body, ?string $fromName = null, ?string $replyTo = null, ?Organization $organization = null): bool
|
||||
{
|
||||
if (! filter_var($to, FILTER_VALIDATE_EMAIL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$logoUrl = null;
|
||||
$companyName = null;
|
||||
if ($organization) {
|
||||
$logoUrl = OrganizationBranding::emailLogoUrl($organization);
|
||||
$companyName = $organization->name;
|
||||
}
|
||||
|
||||
try {
|
||||
Mail::to($to)->send(new ContactMessageMail($subject, $body, $fromName, $replyTo));
|
||||
Mail::to($to)->send(new ContactMessageMail($subject, $body, $fromName, $replyTo, $logoUrl, $companyName));
|
||||
|
||||
return true;
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
@@ -56,6 +56,9 @@ class MeetNotificationService
|
||||
$invitation->email,
|
||||
'Invitation: '.$room->title,
|
||||
$this->invitationBody($room, $host, $invitation),
|
||||
null,
|
||||
null,
|
||||
$room->organization,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -83,6 +86,9 @@ class MeetNotificationService
|
||||
$host->email,
|
||||
'Recording ready: '.$recording->session->room->title,
|
||||
'Your meeting recording is ready to view at '.route('meet.recordings.show', $recording),
|
||||
null,
|
||||
null,
|
||||
$recording->session->room->organization,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -101,6 +107,9 @@ class MeetNotificationService
|
||||
$host->email,
|
||||
'Reminder: '.$room->title.' starts soon',
|
||||
'Your meeting starts at '.$room->scheduled_at?->timezone($room->timezone)->format('M j, Y g:i A T')."\n\nJoin: ".$room->joinUrl(),
|
||||
null,
|
||||
null,
|
||||
$room->organization,
|
||||
);
|
||||
|
||||
$host->notify(new MeetingReminderNotification($room));
|
||||
@@ -113,6 +122,9 @@ class MeetNotificationService
|
||||
$invitation->email,
|
||||
'Reminder: '.$room->title.' starts soon',
|
||||
'You are invited to a meeting starting at '.$room->scheduled_at?->timezone($room->timezone)->format('M j, Y g:i A T')."\n\nJoin: ".$room->joinUrl(),
|
||||
null,
|
||||
null,
|
||||
$room->organization,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,4 +47,27 @@ class OrganizationBranding
|
||||
Storage::disk('public')->delete($organization->logo_path);
|
||||
}
|
||||
}
|
||||
|
||||
public static function emailLogoUrl(Organization $organization): ?string
|
||||
{
|
||||
if (! self::hasCustomLogo($organization)) {
|
||||
return null;
|
||||
}
|
||||
$ext = strtolower(pathinfo($organization->logo_path, PATHINFO_EXTENSION));
|
||||
if ($ext === 'svg') {
|
||||
return null;
|
||||
}
|
||||
$version = $organization->updated_at?->getTimestamp() ?? time();
|
||||
|
||||
return Storage::disk('public')->url($organization->logo_path).'?v='.$version;
|
||||
}
|
||||
|
||||
public static function wrapEmailHtml(string $bodyHtml, Organization $organization): string
|
||||
{
|
||||
return view('email.customer-branded', [
|
||||
'logoUrl' => self::emailLogoUrl($organization),
|
||||
'companyName' => $organization->name,
|
||||
'bodyHtml' => $bodyHtml,
|
||||
])->render();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user