Fix: don't swallow SMTP errors — return failure to JS so fallback fires

This commit is contained in:
John Loper II
2026-05-11 21:36:16 -04:00
parent 7f1e4b98ee
commit 618fd53854
12 changed files with 21 additions and 20 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

+15 -15
View File
@@ -342,38 +342,38 @@
<div class="work-grid"> <div class="work-grid">
<div class="work-item"> <div class="work-item">
<picture> <picture>
<source srcset="img/work-1-truck-setup.webp" type="image/webp"> <source srcset="img/before-barrels.webp" type="image/webp">
<img src="img/work-1-truck-setup.jpg" alt="Williams Pressure Washing truck fleet washing setup" loading="lazy"> <img src="img/before-barrels.jpg" alt="Before: Backyard cluttered with scattered blue barrels and debris" loading="lazy">
</picture> </picture>
<p class="work-caption">Fleet Washing — On-site Setup</p> <p class="work-caption">Before — Yard Cluttered with Barrels</p>
</div> </div>
<div class="work-item"> <div class="work-item">
<picture> <picture>
<source srcset="img/work-2-action-washing.webp" type="image/webp"> <source srcset="img/before-messy.webp" type="image/webp">
<img src="img/work-2-action-washing.jpg" alt="Worker pressure washing the truck — showing the real work" loading="lazy"> <img src="img/before-messy.jpg" alt="Before: Overgrown yard with scattered debris" loading="lazy">
</picture> </picture>
<p class="work-caption">In Action — Pressure Washing in Progress</p> <p class="work-caption">Before — Overgrown & Messy Yard</p>
</div> </div>
<div class="work-item"> <div class="work-item">
<picture> <picture>
<source srcset="img/work-3-clean-white-truck.webp" type="image/webp"> <source srcset="img/after-clean.webp" type="image/webp">
<img src="img/work-3-clean-white-truck.jpg" alt="Clean white semi-truck after professional washing" loading="lazy"> <img src="img/after-clean.jpg" alt="After: Clean yard with barrels removed and yard cleared" loading="lazy">
</picture> </picture>
<p class="work-caption">Clean Result — White Semi-Truck</p> <p class="work-caption">After — Yard Cleared & Cleaned Up</p>
</div> </div>
<div class="work-item"> <div class="work-item">
<picture> <picture>
<source srcset="img/work-4-clean-wheels.webp" type="image/webp"> <source srcset="img/after-mowed.webp" type="image/webp">
<img src="img/work-4-clean-wheels.jpg" alt="Clean truck wheels and chassis" loading="lazy"> <img src="img/after-mowed.jpg" alt="After: Freshly mowed lawn looking neat" loading="lazy">
</picture> </picture>
<p class="work-caption">Attention to Detail — Wheels & Chassis</p> <p class="work-caption">After — Freshly Mowed</p>
</div> </div>
<div class="work-item"> <div class="work-item">
<picture> <picture>
<source srcset="img/work-5-clean-side-view.webp" type="image/webp"> <source srcset="img/after-wide.webp" type="image/webp">
<img src="img/work-5-clean-side-view.jpg" alt="Clean truck from the side — professional fleet result" loading="lazy"> <img src="img/after-wide.jpg" alt="After: Wide view of completed yard cleanup" loading="lazy">
</picture> </picture>
<p class="work-caption">Final Result — Side View</p> <p class="work-caption">After — Full Yard Transformation</p>
</div> </div>
</div> </div>
</div> </div>
+6 -5
View File
@@ -99,11 +99,12 @@ try {
"Sent from loperboys.com\n"; "Sent from loperboys.com\n";
$mail->send(); $mail->send();
echo json_encode(['success' => true]);
} catch (Exception $e) { } catch (Exception $e) {
// Log the error internally, don't expose to user $error = $mail->ErrorInfo;
error_log("LoperBoys email failed: {$mail->ErrorInfo}"); error_log("LoperBoys email failed: $error");
// Return failure so the JS shows the fallback (mailto) instead of fake success
http_response_code(500);
echo json_encode(['success' => false, 'error' => 'Email delivery failed. Please call us directly.']);
} }
// Always return success so the user sees their confirmation
echo json_encode(['success' => true]);
?> ?>