Deploy Ladill Queue / deploy (push) Successful in 56s
Phases 1–6: tickets, counters, displays, appointments, workflows, rules, analytics, reports, feedback, admin, device API, and Gitea deploy workflow for queue.ladill.com. Co-authored-by: Cursor <cursoragent@cursor.com>
33 lines
945 B
PHP
33 lines
945 B
PHP
<?php
|
|
|
|
namespace App\Services\Comms;
|
|
|
|
use App\Mail\ContactMessageMail;
|
|
use Illuminate\Support\Facades\Log;
|
|
use Illuminate\Support\Facades\Mail;
|
|
|
|
/**
|
|
* Outbound email to contacts. Uses the app's configured mailer (set MAIL_* to
|
|
* a Ladill Bird SMTP credential in production so mail leaves as the account's
|
|
* sender). Failures are swallowed + logged; the caller decides what to record.
|
|
*/
|
|
class EmailService
|
|
{
|
|
public function send(string $to, string $subject, string $body, ?string $fromName = null, ?string $replyTo = null): bool
|
|
{
|
|
if (! filter_var($to, FILTER_VALIDATE_EMAIL)) {
|
|
return false;
|
|
}
|
|
|
|
try {
|
|
Mail::to($to)->send(new ContactMessageMail($subject, $body, $fromName, $replyTo));
|
|
|
|
return true;
|
|
} catch (\Throwable $e) {
|
|
Log::warning('CRM email send failed', ['to' => $to, 'error' => $e->getMessage()]);
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|