debugging rsvp-submit.php
This commit is contained in:
1 parent
1ff5581efd
commit
891ffce73e
10 files changed
+41
-67
No files matched your search
+1
-14
@@ -1,9 +1,7 @@
|
||||
<?php
|
||||
|
||||
file_put_contents('/tmp/rsvp-debug.log', "1\n", FILE_APPEND);
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
file_put_contents('/tmp/rsvp-debug.log', "2\n", FILE_APPEND);
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
@@ -12,7 +10,6 @@ use Dotenv\Dotenv;
|
||||
$dotenv = Dotenv::createImmutable(__DIR__ . '/../');
|
||||
$dotenv->safeLoad();
|
||||
|
||||
file_put_contents('/tmp/rsvp-debug.log', "3\n", FILE_APPEND);
|
||||
|
||||
function checkboxArrayToString($value)
|
||||
{
|
||||
@@ -103,18 +100,14 @@ foreach ($fields as &$field) {
|
||||
$field = mb_convert_encoding($field, 'UTF-8', 'auto');
|
||||
}
|
||||
|
||||
file_put_contents('/tmp/rsvp-debug.log', "4\n", FILE_APPEND);
|
||||
$mail = new PHPMailer(true);
|
||||
|
||||
try {
|
||||
|
||||
$mail->CharSet = 'UTF-8';
|
||||
|
||||
error_log("SMTP_HOST=" . $_ENV['SMTP_HOST']);
|
||||
error_log("SMTP_PORT=" . $_ENV['SMTP_PORT']);
|
||||
error_log("SMTP_USER=" . $_ENV['SMTP_USER']);
|
||||
$mail->isSMTP();
|
||||
$mail->Host = $_ENV['SMTP_HOST'];
|
||||
$mail->Host = gethostbyname($_ENV['SMTP_HOST']);
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->Username = $_ENV['SMTP_USER'];
|
||||
$mail->Password = $_ENV['SMTP_PASS'];
|
||||
@@ -203,14 +196,8 @@ EOD;
|
||||
|
||||
$mail->Body = $body;
|
||||
|
||||
file_put_contents('/tmp/rsvp-debug.log', "5\n", FILE_APPEND);
|
||||
$mail->SMTPDebug = 2;
|
||||
$mail->Debugoutput = 'error_log';
|
||||
$mail->Timeout = 10;
|
||||
error_log("About to send mail");
|
||||
$mail->send();
|
||||
error_log("Mail sent");
|
||||
file_put_contents('/tmp/rsvp-debug.log', "6\n", FILE_APPEND);
|
||||
|
||||
header('Location: /thank-you/');
|
||||
exit;
|
||||
|
||||
Reference in new issue
Block a user