JezK
Edit File: email.php
<?php require 'mailjet/vendor/autoload.php'; use \Mailjet\Resources; use \Mailjet\Client; // Zero Payment function send_email($email,$name) { $mailContent = 'Registration confirmation'; $message = " <!DOCTYPE html> <html lang='en'> <head> <meta charset='UTF-8'> <meta name='viewport' content='width=device-width, initial-scale=1.0'> <title>Registration Confirmation</title> </head> <body> <div> Hello <b>$name</b> <p>Welcome to the Rare Earth Industry Association (REIA). Your registration details have been received, and we are in the process of reviewing your application.</p> <p>For security and verification purposes, all new registrations on our website require approval from the administrator.</p> <p>Once the administrator approves your registration, you will receive a confirmation email with instructions on how to log in and access your account.</p> <p>If you have any questions, concerns, or inquiries about your registration, please contact our support team at <a href='mailto: Info@global-reia.org'> Info@global-reia.org</a>. We will be happy to assist you.</p> <p>Thank you.</p> </div> </body> </html> "; $mailjet = new Client('16594394f0c35a603dc4beba160fe2b2', '5cdd046f0a7b26875ef5827099a2af5c', true, ['version' => 'v3.1']); // Prepare the email data $body = [ 'Messages' => [ [ 'From' => [ 'Email' => 'Info@global-reia.org', 'Name' => 'REIA', ], 'To' => [ [ 'Email' => $email, 'Name' => 'REIA', ], ], 'Subject' => $mailContent, 'TextPart' => $message, 'HTMLPart' => $message, ], ], ]; try { // Send the email $response = $mailjet->post(Resources::$Email, ['body' => $body]); // echo '1'; // Success } catch (\Exception $e) { echo '3'; // Error // You may uncomment the line below for debugging, but don't expose it in production // echo 'Mailjet Error: ' . $e->getMessage(); } } function send_email_client($email, $name,$reg_id) { $mailContent = 'New User Registration - Approval Required'; $message = " <!DOCTYPE html> <html lang='en'> <head> <meta charset='UTF-8'> <meta name='viewport' content='width=device-width, initial-scale=1.0'> <title>New User Registration - Approval Required</title> </head> <body> <div> <p>Dear Admin,</p> <p>I hope this email finds you well. We wanted to inform you that a new user has registered on our website and is awaiting approval to become an active member of our REIA community.</p> <p>Here are the details of the new registration:</p> <ul> <li>Register ID: <b>$reg_id</b> </li> <li>User name: <b>$name</b> </li> <li>Email: <b>$email</b> </li> </ul> <p>Please review the registration details at your earliest convenience and approve the user by following the necessary steps in the administrator panel.</p> <p>Once approved, the user will receive a confirmation email with instructions on how to log in and access their account.</p> <p>Thank you.</p> </div> </body> </html>"; $mailjet = new Client('16594394f0c35a603dc4beba160fe2b2', '5cdd046f0a7b26875ef5827099a2af5c', true, ['version' => 'v3.1']); // Prepare the email data $body = [ 'Messages' => [ [ 'From' => [ 'Email' => 'Info@global-reia.org', 'Name' => 'REIA', ], 'To' => [ [ 'Email' => 'Info@global-reia.org', 'Name' => 'REIA', ], ], 'Subject' => $mailContent, 'TextPart' => $message, 'HTMLPart' => $message, ], ], ]; try { // Send the email $response = $mailjet->post(Resources::$Email, ['body' => $body]); // echo '1'; // Success } catch (\Exception $e) { echo '3'; // Error } } // With Payment Mail function send_payment_confirmation_email($email,$name,$booking_id,$transaction_id,$price,$event_id,$date){ $mailContent = 'Booking confirmation'; $message = '<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <style> /* CSS Styles */ body { font-family: Arial, sans-serif; background-color: #f5f5f5; margin: 0; padding: 0; } .container { max-width: 600px; margin: 0 auto; padding: 20px; background-color: #fff; } .header { text-align: center; margin-bottom: 30px; } .header h1 { color: #333; margin: 0; } .invoice-details { margin-bottom: 30px; } .invoice-details p { margin: 5px 0; } .invoice-table { width: 100%; border-collapse: collapse; margin-bottom: 30px; } .invoice-table th, .invoice-table td { padding: 10px; border: 1px solid #ccc; } .invoice-table th { background-color: #f5f5f5; text-align: left; } .total { text-align: right; } .footer { background-color: #f5f5f5; padding: 10px; text-align: center; } </style> </head> <body> <div class="container"> <div class="header"> <h1>Payment Success Invoice</h1> </div> <div class="invoice-details"> <p>Hello <b>'.$name.'</b>,</p> <p>Thank you for registering for the <b>'.$event_id.'</b>. Your payment has been received and your registration has been confirmed. Find the details below.</p>. <h4><strong>Booking ID:</strong>'.$booking_id.' </h4> <h4><strong>Payment ID:</strong> '.$transaction_id.'</h4> <h4><strong>Date:</strong>'.$date.'</h4> <h4><strong>Amount Paid:</strong> €'.$price.'</h4> </div> <table class="invoice-table"> <thead> <tr> <th>Description</th> <th>Price</th> <th>Total</th> </tr> </thead> <tbody> <tr> <td>'.$event_id.'</td> <td>€'.$price.'</td> <td>€'.$price.'</td> </tr> </tbody> <tfoot> <tr> <td colspan="2" class="total"><strong>Total Amount:</strong></td> <td>€ '.$price.'</td> </tr> </tfoot> </table> <div class="footer"> <p>Thank you for your payment.</p> </div> </div> </body> </html>'; $mailjet = new Client('16594394f0c35a603dc4beba160fe2b2', '5cdd046f0a7b26875ef5827099a2af5c', true, ['version' => 'v3.1']); // Prepare the email data $body = [ 'Messages' => [ [ 'From' => [ 'Email' => 'Info@global-reia.org', 'Name' => 'REIA', ], 'To' => [ [ 'Email' => $email, 'Name' => 'REIA', ], ], 'Subject' => $mailContent, 'TextPart' => $message, 'HTMLPart' => $message, ], ], ]; try { // Send the email $response = $mailjet->post(Resources::$Email, ['body' => $body]); // echo '1'; // Success } catch (\Exception $e) { echo '3'; // Error } } function send_payment_confirmation_client($email,$name,$booking_id,$transaction_id,$price,$event_id,$date,$company_name,$city,$country,$position,$mobile,$couponCode,$comments,$vat_number){ $mailContent = 'Booking confirmation'; $message = ' <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <style> /* CSS Styles */ body { font-family: Arial, sans-serif; background-color: #f5f5f5; margin: 0; padding: 0; } .container { max-width: 600px; margin: 0 auto; padding: 20px; background-color: #fff; } .header { text-align: center; margin-bottom: 30px; } .header h1 { color: #333; margin: 0; } .invoice-details { margin-bottom: 30px; } .invoice-details p { margin: 5px 0; } .invoice-table { width: 100%; border-collapse: collapse; margin-bottom: 30px; } .invoice-table th, .invoice-table td { padding: 10px; border: 1px solid #ccc; } .invoice-table th { background-color: #f5f5f5; text-align: left; } .total { text-align: right; } .footer { background-color: #f5f5f5; padding: 10px; text-align: center; } </style> </head> <body> <div class="container"> <div class="header"> <h1>New Payment Notification</h1> </div> <p>Dear Admin,</p> <p>You have received a new payment. Below are the details:</p> <div class="invoice-details"> <h4><strong>Booking ID:</strong>'.$booking_id.'</h4> <h4><strong>Date:</strong> '.$date.'</h4> <h4><strong>Payment ID:</strong> '.$transaction_id . '</h4> <h4><strong>Name:</strong> '.$name . '</h4> <h4><strong>Company:</strong> '.$company_name. '</h4> <h4><strong>Position:</strong> '.$position. '</h4> <h4><strong>Email:</strong> '.$email. '</h4> <h4><strong>Phone Number:</strong> '.$mobile. '</h4> <h4><strong>Country:</strong> '.$country. '</h4> <h4><strong>City:</strong> '.$city. '</h4> <h4><strong>Vat Number:</strong> '.$vat_number. '</h4> <h4><strong>Comments or Message:</strong> '.$comments. '</h4> <h4><strong>Coupon Code:</strong> '.$couponCode. '</h4> </div> <table class="invoice-table"> <thead> <tr> <th>Description</th> <th>Price</th> <th>Total</th> </tr> </thead> <tbody> <tr> <td>'.$event_id.'</td> <td>€ '.$price.'</td> <td>€ '.$price.'</td> </tr> </tbody> <tfoot> <tr> <td colspan="2" class="total"><strong>Total Amount:</strong></td> <td>€ '.$price.'</td> </tr> </tfoot> </table> <div class="footer"> <p>Thank you for your attention.</p> </div> </div> </body> </html>'; $mailjet = new Client('16594394f0c35a603dc4beba160fe2b2', '5cdd046f0a7b26875ef5827099a2af5c', true, ['version' => 'v3.1']); // Prepare the email data $body = [ 'Messages' => [ [ 'From' => [ 'Email' => 'Info@global-reia.org', 'Name' => 'REIA', ], 'To' => [ [ 'Email' =>'Info@global-reia.org', 'Name' => 'REIA', ], ], 'Subject' => $mailContent, 'TextPart' => $message, 'HTMLPart' => $message, ], ], ]; try { // Send the email $response = $mailjet->post(Resources::$Email, ['body' => $body]); // echo '1'; // Success } catch (\Exception $e) { echo '3'; // Error } } function send_zero_payment_confirmation_email($email,$name,$lname,$booking_id,$transaction_id,$price,$event_id,$date){ $mailContent = 'Event Registration'; $message = " <!DOCTYPE html> <html lang='en'> <head> <meta charset='UTF-8'> <meta name='viewport' content='width=device-width, initial-scale=1.0'> <title>Registration Confirmation</title> </head> <body> <div> <p>Hello <b>$name . $lname</b>,</p> <p>Thank you for registering for the upcoming <b>$event_id</b>. Your registration has been confirmed.</p> <p>If you have any questions, concerns, or inquiries about your registration, please contact our support team at <a href='mailto:info@global-reia.org'>info@global-reia.org</a>. We will be happy to assist you.</p> <p>Thank you for joining us at the <b>$event_id</b>.</p> </div> </body> </html> "; $mailjet = new Client('16594394f0c35a603dc4beba160fe2b2', '5cdd046f0a7b26875ef5827099a2af5c', true, ['version' => 'v3.1']); // Prepare the email data $body = [ 'Messages' => [ [ 'From' => [ 'Email' => 'Info@global-reia.org', 'Name' => 'REIA', ], 'To' => [ [ 'Email' => $email, 'Name' => 'REIA', ], ], 'Subject' => $mailContent, 'TextPart' => $message, 'HTMLPart' => $message, ], ], ]; try { // Send the email $response = $mailjet->post(Resources::$Email, ['body' => $body]); // echo '1'; // Success } catch (\Exception $e) { echo '3'; // Error // You may uncomment the line below for debugging, but don't expose it in production // echo 'Mailjet Error: ' . $e->getMessage(); } } function send_zero_payment_confirmation_client($email,$name,$lname,$booking_id,$transaction_id,$price,$event_id,$date,$position,$company_name,$city,$country,$vat_number,$countryCode,$mobile,$coupnCode,$comments){ $mailContent = 'Event Registration'; $message = " <!DOCTYPE html> <html lang='en'> <head> <meta charset='UTF-8'> <meta name='viewport' content='width=device-width, initial-scale=1.0'> <title>Registration Confirmation</title> </head> <body> <div> <p>Hello REIA Team,</p> <p>A new registration has been received for the <b>$event_id</b> event:</p> <ul> <li><b>Name:</b> $name . $lname</li> <li><b>Email:</b> $email</li> <li><b>Booking ID:</b> $booking_id</li> <li><b>Phone Number:</b> $mobile</li> <li><b>Company:</b> $company_name</li> <li><b>Position:</b> $position</li> <li><b>City:</b> $city</li> <li><b>Country:</b> $country</li> <li><b>VAT Number:</b> $vat_number</li> <li><b>Comments or Message:</b> $comments</li> <li><b>Coupon Code:</b> $coupnCode</li> </ul> <p>Please review the application and take necessary actions. If you have any questions, you can reach out to the user at <a href='mailto:$email'>$email</a>.</p> <p>Thank you for your attention.</p> </div> </body> </html> "; $mailjet = new Client('16594394f0c35a603dc4beba160fe2b2', '5cdd046f0a7b26875ef5827099a2af5c', true, ['version' => 'v3.1']); // Prepare the email data $body = [ 'Messages' => [ [ 'From' => [ 'Email' => 'Info@global-reia.org', 'Name' => 'REIA', ], 'To' => [ [ 'Email' =>'Info@global-reia.org', 'Name' => 'REIA', ], ], 'Subject' => $mailContent, 'TextPart' => $message, 'HTMLPart' => $message, ], ], ]; try { // Send the email $response = $mailjet->post(Resources::$Email, ['body' => $body]); // echo '1'; // Success } catch (\Exception $e) { echo '3'; // Error } } ?>