<?php
require_once '../config.php';
require_once '../../../vendor/autoload.php';
require_once "/home/jobaajgroup/public_html/emp3.jobaaj.com/mail/mailLog.php";


date_default_timezone_set('Asia/Kolkata');

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;





function birthday($to)
{

    $current_year = date('Y');

    $mail = new PHPMailer(true);
    try {
        $subject = "Test ";

        $mail->SMTPDebug = 0;
        $mail->isSMTP();
        $mail->CharSet = "UTF-8";

        include __DIR__."/../../mail_send_credential.php";

        // $mail->AddReplyTo($replyTo);
        $mail->addAddress($to);

        $mail->isHTML(true);
        $mail->Subject = $subject;


        $mail->addCustomHeader('X-SES-CONFIGURATION-SET', 'global_mailer');
        $mail->addCustomHeader('X-SES-MESSAGE-TAGS', "camp_id=1");
        $mail->addCustomHeader('X-SES-MESSAGE-TAGS', "extra_data=$json_data");


        $mail->Body = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
            <html xmlns='http://www.w3.org/1999/xhtml' xmlns:v='urn:schemas-microsoft-com:vml' xmlns:o='urn:schemas-microsoft-com:office:office'>
                <head>
                    <meta http-equiv='Content-type' content='text/html; charset=utf8' />
                    <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1' />
                    <meta http-equiv='X-UA-Compatible' content='IE=edge' />
                    <meta name='format-detection' content='date=no' />
                    <meta name='format-detection' content='address=no' />
                    <meta name='format-detection' content='telephone=no' />
                    <meta name='x-apple-disable-message-reformatting' />
                    <link href='https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700,700i&display=swap' rel='stylesheet' />
                    <title>Happy Birthday from Jobaaj</title>
                    <style type='text/css'>
                        /* Client-specific resets */
                        body,
                        table,
                        td,
                        a {
                            -webkit-text-size-adjust: 100%;
                            -ms-text-size-adjust: 100%;
                        }
                        table,
                        td {
                            mso-table-lspace: 0pt;
                            mso-table-rspace: 0pt;
                        }
                        img {
                            -ms-interpolation-mode: bicubic;
                            border: 0;
                            height: auto;
                            line-height: 100%;
                            outline: none;
                            text-decoration: none;
                        }
                        table {
                            border-collapse: collapse !important;
                        }
                        body {
                            height: 100% !important;
                            margin: 0 !important;
                            padding: 0 !important;
                            width: 100% !important;
                        }

                        /* iOS blue links */
                        a[x-apple-data-detectors] {
                            color: inherit !important;
                            text-decoration: none !important;
                            font-size: inherit !important;
                            font-family: inherit !important;
                            font-weight: inherit !important;
                            line-height: inherit !important;
                        }

                        /* Gmail blue links */
                        u + #body a {
                            color: inherit;
                            text-decoration: none;
                            font-size: inherit;
                            font-family: inherit;
                            font-weight: inherit;
                            line-height: inherit;
                        }

                        /* Universal styles */
                        body {
                            font-family: Arial, Helvetica, sans-serif;
                            line-height: 1.6;
                            color: #333333;
                        }
                    </style>
                </head>
                <body style='background:#f3f7f5;'>
                    <!-- Email wrapper -->
                    <table width='100%' style='margin-left:auto; margin-right:auto; width:100%; max-width:680px;' align='center' border='0' cellspacing='0' cellpadding='0'>
                        <tr>
                            <td align='center' valign='top' style='padding: 20px 10px'>
                                <!-- Email container -->
                                <table border='0' cellpadding='0' cellspacing='0' width='600' role='presentation' style='max-width: 600px; margin: 0 auto; background-color: #ffffff; border-radius: 8px;' bgcolor='#ffffff'>
                                    <!-- Header -->
                                    <tr>
                                        <td align='center' valign='top' style='padding: 30px 20px 0px 20px'>
                                            <img src='https://www.jobaaj.com/mail/images/logo.png' alt='Jobaaj Logo' width='200' style=' width: 180px; height: auto; display: block; margin: 0 auto;' border='0'/>
                                        </td>
                                    </tr>

                                    <!-- Main heading -->
                                    <tr>
                                        <td align='center' valign='top' style='padding: 10px 20px 20px 20px'>Testing </td>
                                    </tr>
                                    
                                </table>
                            </td>
                        </tr>
                    </table>
                </body>
            </html> 
        ";
        $mail->AltBody = 'Body in plain text for non-HTML mail clients';
        // return $mail->Body;
        if ($mail->send()) {
            return 1;
        } else {
            return 2;
        }
        // echo $mail->Body;
    } catch (Exception $e) {
        // return "Message could not be sent. Mailer Error: {$e}";
    }
}
echo birthday('iqbalshah9368@gmail.com');