87 lines
3.8 KiB
PHP
87 lines
3.8 KiB
PHP
<?php
|
|
// File: send_payment_received_email.php
|
|
|
|
require_once __DIR__ . '/../connect.php';
|
|
|
|
$driverID = filterRequest('driverID');
|
|
$totalAmount = filterRequest('total_amount');
|
|
$driverPhone = filterRequest('phone');
|
|
$driverArabicName = filterRequest('name_arabic');
|
|
$accountBank = filterRequest('accountBank');
|
|
$driverEmail = filterRequest('email');
|
|
|
|
// لغة الإيميل (تلقائي إنجليزي حالياً، يمكن تعيينها لاحقًا حسب المستخدم)
|
|
$language = 'en';
|
|
|
|
// عنوان واسم التطبيق الرسمي
|
|
$appName = "tripz"; // الاسم الجديد مع حرف "Z"
|
|
$domain = "https://tripz-egypt.com";
|
|
|
|
// محتوى الإيميل - باللغة الإنجليزية
|
|
$bodyEmail = "<html>
|
|
<head>
|
|
<style>
|
|
body { font-family: Arial, sans-serif; color: #333; background: #f9f9f9; padding: 20px; }
|
|
.container { background: #fff; padding: 30px; border-radius: 8px; max-width: 600px; margin: auto; }
|
|
h1 { color: #007bff; }
|
|
p { font-size: 16px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class='container'>
|
|
<img src='$domain/assets/logo.png' alt='$appName Logo' style='width: 150px; margin: 20px auto; display: block;'>
|
|
<h1>Payment Sent - $appName</h1>
|
|
<p>Thank you for being a valued driver on the $appName platform.</p>
|
|
<p>We have sent a payment of <strong>$totalAmount EGP</strong> to your account <strong>$accountBank</strong>.</p>
|
|
<p>Please note that it may take a few days for your bank to process this transaction.</p>
|
|
<p>We appreciate your efforts and are proud to have you on board with $appName.</p>
|
|
<p style='margin-top: 40px;'>Regards,<br><strong>tripz Team</strong></p>
|
|
<p style='font-size: 12px; color: #888;'>tripz, Egypt | $domain</p>
|
|
</div>
|
|
</body>
|
|
</html>";
|
|
|
|
// محتوى الإيميل - باللغة العربية
|
|
$bodyEmailAr = "<html>
|
|
<head>
|
|
<style>
|
|
body { font-family: 'Cairo', sans-serif; color: #333; background: #f9f9f9; padding: 20px; direction: rtl; }
|
|
.container { background: #fff; padding: 30px; border-radius: 8px; max-width: 600px; margin: auto; text-align: right; }
|
|
h1 { color: #007bff; }
|
|
p { font-size: 16px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class='container'>
|
|
<img src='$domain/assets/logo.png' alt='$appName' style='width: 150px; margin: 20px auto; display: block;'>
|
|
<h1>تم إرسال الدفعة - $appName</h1>
|
|
<p>شكرًا لك لكونك سائقًا مميزًا على منصة $appName.</p>
|
|
<p>لقد تم إرسال دفعة قدرها <strong>$totalAmount جنيه</strong> إلى حسابك <strong>$accountBank</strong>.</p>
|
|
<p>يرجى ملاحظة أن عملية التحويل قد تستغرق بضعة أيام حسب إجراءات البنك.</p>
|
|
<p>نقدّر جهودك ونتطلع إلى استمرار الشراكة معك على تطبيق $appName.</p>
|
|
<p style='margin-top: 40px;'>مع التحية،<br><strong>فريق $appName</strong></p>
|
|
<p style='font-size: 12px; color: #888;'>$appName - مصر | $domain</p>
|
|
</div>
|
|
</body>
|
|
</html>";
|
|
|
|
// إعدادات الإيميل
|
|
$supportEmail = 'support@tripz-egypt.com';
|
|
$headers = "MIME-Version: 1.0\r\n";
|
|
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
|
|
$headers .= "From: tripz Egypt <$supportEmail>\r\n";
|
|
|
|
// إرسال الإيميل إن وُجد عنوان صالح
|
|
if (!empty($driverEmail)) {
|
|
$subject = "Payment Sent - $appName";
|
|
$message = ($language === 'ar') ? $bodyEmailAr : $bodyEmail;
|
|
|
|
if (mail($driverEmail, $subject, $message, $headers)) {
|
|
jsonSuccess(null, "Email sent successfully to $driverEmail");
|
|
} else {
|
|
jsonError("Failed to send email to $driverEmail");
|
|
}
|
|
} else {
|
|
jsonError("Invalid or missing driver email address.");
|
|
}
|
|
?>
|