mailer->lastError(); } public function sendProgrammeShare( string $ownerPublicId, string $to, string $eventName, string $programmeUrl, ?string $attendeeName = null, ?string $organizerEmail = null, ?string $organizerName = null, ): bool { return $this->send( $ownerPublicId, $to, 'Programme for '.$eventName, 'mail.notifications.event-programme', compact('eventName', 'programmeUrl', 'attendeeName'), $organizerEmail, $organizerName, ); } public function sendJoinLink( string $ownerPublicId, string $to, string $eventName, string $joinUrl, ?string $attendeeName = null, ?string $organizerEmail = null, ?string $organizerName = null, ): bool { return $this->send( $ownerPublicId, $to, 'Join '.$eventName, 'mail.notifications.event-join', compact('eventName', 'joinUrl', 'attendeeName'), $organizerEmail, $organizerName, ); } public function sendJoinAndProgramme( string $ownerPublicId, string $to, string $eventName, string $joinUrl, string $programmeUrl, ?string $attendeeName = null, ?string $organizerEmail = null, ?string $organizerName = null, ): bool { return $this->send( $ownerPublicId, $to, $eventName.' — programme & join link', 'mail.notifications.event-join-programme', compact('eventName', 'joinUrl', 'programmeUrl', 'attendeeName'), $organizerEmail, $organizerName, ); } public function sendRegistrationConfirmation( string $ownerPublicId, string $to, string $eventName, string $badgeCode, ?string $joinUrl = null, ?string $attendeeName = null, ?string $organizerEmail = null, ?string $organizerName = null, ): bool { return $this->send( $ownerPublicId, $to, 'Registration confirmed — '.$eventName, 'mail.notifications.event-registration-confirmed', compact('eventName', 'badgeCode', 'joinUrl', 'attendeeName'), $organizerEmail, $organizerName, ); } public function sendSpeakerInvite( string $ownerPublicId, string $to, string $eventName, string $portalUrl, ?string $speakerName = null, ?string $organizerEmail = null, ?string $organizerName = null, ): bool { return $this->send( $ownerPublicId, $to, 'Speaker invitation — '.$eventName, 'mail.notifications.event-speaker-invite', [ 'eventName' => $eventName, 'portalUrl' => $portalUrl, 'speakerName' => $speakerName, ], $organizerEmail, $organizerName, ); } /** @param array $viewData */ private function send( string $ownerPublicId, string $to, string $subject, string $view, array $viewData, ?string $replyToEmail = null, ?string $replyToName = null, ): bool { $brandingSettings = AccountBranding::forOwnerRef($ownerPublicId); $viewData['logoUrl'] = AccountBranding::emailLogoUrl($brandingSettings); $viewData['companyName'] = AccountBranding::companyName($brandingSettings); // From display: organizer name, else account/company branding — never "Ladill Events". $fromName = trim((string) ($replyToName ?: $viewData['companyName'] ?? '')) ?: null; $html = View::make($view, $viewData)->render(); $text = strip_tags(str_replace(['
', '
', '
'], "\n", $html)); return $this->mailer->send( $ownerPublicId, $to, $subject, $html, $text, $replyToEmail, $replyToName, $fromName, ); } }