isSMTP(); $mail->Host = $host; $mail->Port = $port; $mail->SMTPAuth = ($auth === 'yes'); if ($mail->SMTPAuth) { $mail->Username = $username; $mail->Password = $password; } if ($encryption === 'ssl') { $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; } elseif ($encryption === 'tls') { $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; } else { $mail->SMTPSecure = false; $mail->SMTPAutoTLS = false; } $mail->setFrom($fromEmail, $fromName); $mail->addAddress($toEmail); $mail->Subject = $subject; $mail->isHTML(true); $mail->Body = nl2br(htmlspecialchars($message)); $mail->AltBody = $message; $mail->send(); $result = true; $messageId = $mail->getLastMessageID(); } catch (Exception $e) { $result = false; $error = $mail->ErrorInfo ?: $e->getMessage(); } } ?>
= htmlspecialchars($messageId) ?>
= htmlspecialchars($error) ?>