WizdomWeb/app/Services/ContactService.php

43 lines
1.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* File: ContactService.php
* Version: 1.0
* Path: /app/Services/ContactService.php
* Purpose: Sends verification email for contact form submissions
* Project: Wizdom Networks Website
*/
namespace WizdomNetworks\WizeWeb\Services;
use WizdomNetworks\WizeWeb\Utilities\EmailHelper;
use WizdomNetworks\WizeWeb\Utilities\Logger;
class ContactService
{
/**
* Sends a contact email verification message
*
* @param string $email The user's email address
* @param string $code The unique verification code
* @return bool True if email was sent successfully
*/
public static function sendVerificationEmail(string $email, string $code): bool
{
$appUrl = $_ENV['APP_URL'] ?? 'https://wizdom.ca';
$verifyUrl = "$appUrl/verify/$code";
$subject = "Please verify your email address";
$body = <<<HTML
<p>Hello,</p>
<p>Thank you for reaching out to Wizdom Networks. To complete your contact request, please verify your email address by clicking the link below:</p>
<p><a href="$verifyUrl">Verify Email Address</a></p>
<p>If you did not submit this request, you can safely ignore this message.</p>
<p> The Wizdom Networks Team</p>
HTML;
Logger::info("Sending contact verification email to: $email");
return EmailHelper::send($email, $subject, $body);
}
}