Здравствуйте уважаемые пользователи!
Столкнулся с багом оправки емайлов при заказе трансфера. Не могу понять закономерности в чем может быть проблема.
<?php
define("ROOT", $_SERVER['DOCUMENT_ROOT']);
require_once (ROOT."/configs/config.php");
require (ROOT."/vendor/PHPMailer.php");
require (ROOT."/vendor/Exception.php");
require("autoload.php");
\Stripe\Stripe::setApiKey('sk_live_key');
$stripe_dashboard = 'https://dashboard.stripe.com/test/search?query';
$user_device = $_COOKIE["cookie_user_device"];
$service_type = $_COOKIE["cookie_type"];
$pickup_point = $_COOKIE["cookie_departure_address"];
$drop_point = $_COOKIE["cookie_destination_address"];
$date_time = $_COOKIE["cookie_departure_date"];
$flight_number = $_COOKIE["cookie_flight_number"];
$room_number = $_COOKIE["cookie_room_number"];
$name = $_COOKIE["cookie_name"];
$email = $_COOKIE["cookie_email"];
$phone_number = "+".$_COOKIE["cookie_country_code"] . $_COOKIE["cookie_phone"];
$passenger_count = $_COOKIE["cookie_passenger_count"];
$additional_information = $_COOKIE["cookie_additional_information"];
$price = $_COOKIE["cookie_price"];
$price_card = $_COOKIE["cookie_price_card"];
$price_driver = $_COOKIE["cookie_price_driver"];
$discount = $_COOKIE["cookie_discount"];
$discount_price = $_COOKIE["cookie_discount_price"];
$payment_method = $_COOKIE["cookie_payment_method"];
$session = $_COOKIE["cookie_stripe_session_id"];
$intent = $_COOKIE["cookie_stripe_intent"];
$stripe_customer = \Stripe\Checkout\Session::retrieve($session);
$customer = $stripe_customer->customer;
$service_type = strtoupper($service_type);
$name = ucwords($name);
$email = strtolower($email);
$flight_number = strtoupper($flight_number);
if($payment_method == 'Creditcard'){
$payment = 'Transfer is already payment.';
}else if($payment_method == 'Partialpayment'){
$payment = '€ '.$price_driver.'<br />* commission is already payment.';
}
if(isset($flight_number)){
$flight_number_echo = $flight_number;
}
else if(isset($room_number)){
$room_number_echo = $room_number;
} else {
$null = '';
}
if(isset($additional_information)){
$additional_information_echo = $additional_information;
} else {
$null = '';
}
if (!empty($email) && !empty($phone_number)) {
ob_start();
include("html-template-carrier.php");
$template_carrier = ob_get_contents();
ob_end_clean();
$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->CharSet = 'utf-8';
$mail->setFrom(''.$email.'', ''.$name.'');
$mail->addAddress('info@intaxi.si');
$mail->Subject = 'New "'.$service_type.'" order from intaxi.si ';
$mail->msgHTML(''.$template_carrier.'');
ob_start();
include("html-template-customer.php");
$template_customer = ob_get_contents();
ob_end_clean();
$mailCustomer = new PHPMailer\PHPMailer\PHPMailer();
$mailCustomer->CharSet = 'utf-8';
$mailCustomer->setFrom('info@intaxi.si');
$mailCustomer->addAddress($email);
$mailCustomer->Subject = '[ ORDER CONFIRMATION ] - Your "'.$service_type.'" order from intaxi.si ';
$mailCustomer->msgHTML(''.$template_customer.'');
if ($mail->send() && $mailCustomer->send()) { ?>
<!DOCTYPE html>
<html lang="en">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Payment Successful!</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="description" content="Innovative taxi in Ljubljana. The most favorable prices, convenient cars and any methods of payment.">
<meta property="og:type" content="website">
<meta property="og:url" content="https://intaxi.si/">
<meta property="og:title" content="inTaxi Ljubljana — Get your Taxi Now!">
<meta property="og:image" content="https://intaxi.si/assets/imgs/general/og-img.png">
<meta property="og:description" content="Innovative taxi in Ljubljana. The most favorable prices, convenient cars and any methods of payment.">
<meta property="og:site_name" content="inTaxi">
<meta property="og:locale" content="en_SI">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<!-- Favicons -->
<link rel="icon" href="/assets/icons/favicons/favicon.png" type="image/png">
<link rel="apple-touch-icon" href="/assets/icons/favicons/apple-touch-icon.png" type="image/png">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="/components/normalize/normalize.css">
<link rel="stylesheet" href="/components/fontawesome/css/all.css">
<link rel="stylesheet" href="/assets/css/success-error.css">
</head>
<body>
<div class="container success">
<div class="success-box">
<div class="face face-happy">
<div class="eye"></div>
<div class="eye right"></div>
<div class="mouth happy"></div>
</div>
<div class="shadow scale"></div>
<div class="message">
<h1 class="alert">Success!</h1>
<p>We have received your payment</p>
<p>Please check email (<? echo $email; ?>) </p>
</div>
<div class="action">
<a href="https://intaxi.si" class="button-box green">continue</a>
</div>
</div>
</div>
<script src="/components/jquery/jquery-3.4.1.min.js"></script>
<script src="/components/jquerycookie/jquery.cookie.js"></script>
<script>
$.removeCookie('cookie_type', { path: '/' });
$.removeCookie('cookie_departure_address', { path: '/' });
$.removeCookie('cookie_destination_address', { path: '/' });
$.removeCookie('cookie_departure_date', { path: '/' });
$.removeCookie('cookie_flight_number', { path: '/' });
$.removeCookie('cookie_room_number', { path: '/' });
$.removeCookie('cookie_name', { path: '/' });
$.removeCookie('cookie_email', { path: '/' });
$.removeCookie('cookie_country_code', { path: '/' });
$.removeCookie('cookie_phone', { path: '/' });
$.removeCookie('cookie_additional_information', { path: '/' });
$.removeCookie('cookie_price', { path: '/' });
$.removeCookie('cookie_price_card', { path: '/' });
$.removeCookie('cookie_price_driver', { path: '/' });
$.removeCookie('cookie_discount_price', { path: '/' });
$.removeCookie('cookie_payment_method', { path: '/' });
$.removeCookie('cookie_stripe_session_id', { path: '/' });
$.removeCookie('cookie_stripe_intent', { path: '/' });
$.removeCookie('cookie_passenger_count', { path: '/' });
$.removeCookie('cookie_discount', { path: '/' });
$.removeCookie('cookie_discount_query', { path: '/' });
</script>
</body>
</html>
<?php
} else {
header("Location: https://intaxi.si/cancel.php");
exit();
}
} else {
header("Location: https://intaxi.si/cancel.php");
exit();
}
?>
Пробовал с личных емайлов, все супер работает. Но было два клиента когда ни нам ни им подтверждение не приходит, при этом оплата проходит успешно.
Выяснили то что, если емайла не существует - в папку спам приходит информация по трансферу и то что не удалось отправить емайл клиенту.
Прошу знающих подсказать, где искать решение!