Edit file File name : mail.php Content :<?php use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; require 'PHPMailer/src/Exception.php'; require 'PHPMailer/src/PHPMailer.php'; require 'PHPMailer/src/SMTP.php'; $email = $_POST['email']; $referral_code = $_POST['referral_code']; $number_of_people = 0; $referral_code_build = substr($email, 0, 4) . rand(100000, 999999); $host = 'localhost'; $db = 'chornata_artland'; $user = 'chornata_timelin'; $pass = '1p6)fSU!5W'; $charset = 'utf8'; $dsn = "mysql:host=$host;dbname=$db;charset=$charset"; $opt = [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES => false, ]; $pdo = new PDO($dsn, $user, $pass, $opt); $email_bd = $pdo->query("SELECT email FROM infouser WHERE email = '{$email}'"); $referral_code_bd = $pdo->query("SELECT referral_code FROM infouser WHERE referral_code = '{$referral_code}'"); $eq_email = $email_bd->fetch(); $eq_code = $referral_code_bd->fetch(); //______________________________________Main Email________________________ $mail = new PHPMailer(true); //Recipients $mail->SetFrom('info@artforsocial.com'); //$mail->addAddress('earlysignups.afs@gmail.com'); // Add a recipient $mail->addAddress('tulchinsky.dmitry@gmail.com'); // Add a recipient $mail->addReplyTo($email, 'Subscriber'); //Content $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'Artforsocial.com new subscriber!'; $mail->Body = 'Email: ' . $email; //______________________________________Subscribe Email________________________ $mail_user = new PHPMailer(true); //Recipients $mail_user->SetFrom('earlysignups.afs@gmail.com'); $mail_user->addAddress($email); // Add a recipient $mail_user->addReplyTo('earlysignups.afs@gmail.com', 'Artforsocial'); //Content $mail_user->isHTML(true); // Set email format to HTML $mail_user->Subject = 'Artforsocial: you are added to list of early bird subscribers!'; $mail_user->Body = '<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title>Sign Up</title> <style type="text/css"> /* Client-specific Styles */ div, p, a, li, td { -webkit-text-size-adjust: none; } #outlook a { padding: 0; } /* Force Outlook to provide a "view in browser" menu link. */ html { width: 100%; } body { width: 100% !important; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; margin: 0; padding: 0; } /* Prevent Webkit and Windows Mobile platforms from changing default font sizes, while not breaking desktop design. */ .ExternalClass { width: 100%; } /* Force Hotmail to display emails at full width */ .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { line-height: 100%; } /* Force Hotmail to display normal line spacing. */ #backgroundTable { margin: 0; padding: 0; width: 100% !important; line-height: 100% !important; } img { outline: none; text-decoration: none; border: none; -ms-interpolation-mode: bicubic; } a img { border: none; } .image_fix { display: block; } p { margin: 0px 0px !important; } table td { border-collapse: collapse; } table { border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; } a { color: #33b9ff; text-decoration: none; text-decoration: none !important; } /*STYLES*/ table[class=full] { width: 100%; clear: both; } /*IPAD STYLES*/ @media only screen and (max-width: 640px) { a[href^="tel"], a[href^="sms"] { text-decoration: none; color: #33b9ff; /* or whatever your want */ pointer-events: none; cursor: default; } .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] { text-decoration: default; color: #33b9ff !important; pointer-events: auto; cursor: default; } table[class=devicewidth] { width: 440px !important; text-align: center !important; } table[class=devicewidthinner] { width: 420px !important; text-align: center !important; } } /*IPHONE STYLES*/ @media only screen and (max-width: 480px) { a[href^="tel"], a[href^="sms"] { text-decoration: none; color: #33b9ff; /* or whatever your want */ pointer-events: none; cursor: default; } .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] { text-decoration: default; color: #33b9ff !important; pointer-events: auto; cursor: default; } table[class=devicewidth] { width: 320px !important; text-align: center !important; } table[class=devicewidthinner] { width: 320px !important; text-align: center !important; } td[class=main_title]{ font-size: 40px !important; line-height: 45px !important; } td[class=logo_top]{ height: 30px !important; } td[class=logo_bottom]{ height: 20px !important; } td[class=mobile_30]{ height: 30px !important; } td[class=mobile_25]{ height: 20px !important; } } </style> </head> <body> <!-- start of Full text --> <table width="100%" bgcolor="#fff" cellpadding="0" cellspacing="0" border="0" st-sortable="full-text"> <tbody> <tr> <td> <table width="600" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth"> <tbody> <tr> <td width="100%"> <table bgcolor="#ffffff" width="600" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth"> <tbody> <tr> <td> <table width="445" align="center" cellpadding="0" cellspacing="0" border="0" class="devicewidthinner"> <tbody> <!-- content --> <!-- Spacing --> <tr> <td height="50" class="logo_top" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> <tr> <td align="center" width="100%"> <div class="imgpop" align="center" width="100%"> <a target="_blank" href="http://social-images-landing.techflagman.com/" align="center" style="display: block; width: 100%; text-align: center; margin: 0 auto;"> <img align="center" src="http://social-images-landing.techflagman.com/img/logo.png" alt="logo" border="0" height="51" width="51" style="display:block; border:none; outline:none; text-decoration:none; margin: 0 auto"> </a> </div> </td> </tr> <!-- Spacing --> <tr> <td height="36" class="logo_bottom" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> <tr> <td class="main_title" style="font-family: Arial, sans-serif; font-size: 55px; font-weight: 500; color: #212121; text-align:center; line-height: 63px;"> You’re In </td> </tr> <!-- End of content --> <!-- Spacing --> <tr> <td width="100%" height="20" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> <!-- content --> <tr> <td class="content_p" style="font-family: Arial, sans-serif; font-weight: 400; font-size: 17px; color: #212121; text-align:center; line-height: 27px;"> You’re now part of a community that wants to make social media marketing fun, easy and inspiring. Share ideas with your team. Collaborate on calendar designs. Download beautiful, ready-to-edit social packs and templates. </td> </tr> <!-- End of content --> <!-- Spacing --> <tr> <td width="100%" height="30" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> <!-- content --> <tr> <td> <img src="http://social-images-landing.techflagman.com/img/illustration.png" alt="logo" border="0" width="100%" style="display:block; border:none; outline:none; text-decoration:none;"> </td> </tr> <!-- End of content --> <!-- Spacing --> <tr> <td class="mobile_30" width="100%" height="40" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> <!-- content --> <tr> <td class="title_p" style="font-family: Arial, sans-serif; font-weight: 700; font-size: 18px; color: #212121; text-align:center; line-height: 30px;"> We have added a $50 early bird credit to your email. </td> </tr> <!-- End of content --> <!-- content --> <tr> <td class="content_p" style="font-family: Arial, sans-serif; font-weight: 400; font-size: 17px; color: #212121; text-align:center; line-height: 27px;"> As promised, we have applied a $50 early bird credit to your email address. This will automatically be applied to your Artforsocial account when we launch our platform. </td> </tr> <!-- End of content --> <!-- Spacing --> <tr> <td class="mobile_30" width="100%" height="40" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> <!-- content --> <tr> <td class="title_p" style="font-family: Arial, sans-serif; font-weight: 700; font-size: 18px; color: #212121; text-align:center; line-height: 30px;"> Your Referral Code </td> </tr> <!-- End of content --> <!-- content --> <tr> <td class="content_p" style="font-family: Arial, sans-serif; font-weight: 400; font-size: 17px; color: #212121; text-align:center; line-height: 27px;"> Your personalized referral code is <span style="color: #AA4279; font-weight: 600;">'.$referral_code_build.'</span>. Share this code with your friends. If 2 people sign up using this code, you will receive an additional $50 credit. </td> </tr> <!-- End of content --> <!-- Spacing --> <tr> <td width="100%" height="25" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> <!-- content --> <tr> <td width="100%" align="center"> <div class="main-link" align="center" style="width: 100%; text-align:center; display: inline; margin: 0 auto;"> <a href="https://twitter.com/Artforsocial1" style="display: inline; margin: 0 10px 0 10px;"><img src="http://social-images-landing.techflagman.com/img/twitter.png" alt="twitter" style="display:inline; border:none; outline:none; text-decoration:none;"></a> <a href="https://www.facebook.com/artforsocial" style="display: inline; margin: 0 10px 0 10px;"><img src="http://social-images-landing.techflagman.com/img/facebook.png" alt="twitter" style="display:inline; border:none; outline:none; text-decoration:none;"></a> <a href="https://www.instagram.com/artforsocial" style="display: inline; margin: 0 10px 0 10px;"><img src="http://social-images-landing.techflagman.com/img/instagram.png" alt="twitter" style="display:inline; height: 25px; width: 25px; border-radius: 50%; border:none; outline:none; text-decoration:none;"></a> </div> </td> </tr> <!-- End of content --> <!-- Spacing --> <tr> <td class="mobile_25" width="100%" height="35" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> <!-- Spacing --> <tr> <td width="100%" height="2" style="font-size:1px; line-height:2px; mso-line-height-rule: exactly; background-color: #C7C7C7;"> </td> </tr> <!-- Spacing --> <!-- Spacing --> <tr> <td width="100%" height="28" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> <tr> <td align="center"> <div class="imgpop"> <a target="_blank" href="http://social-images-landing.techflagman.com/"> <img src="http://social-images-landing.techflagman.com/img/logo.png" alt="logo" border="0" height="30" width="30" style="display:block; border:none; outline:none; text-decoration:none; margin: 0 auto"> </a> </div> </td> </tr> <!-- Spacing --> <tr> <td width="100%" height="12" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> <!-- content --> <tr> <td class="content_p" style="font-family: Arial, sans-serif; font-weight: 400; font-size: 15px; color: #909090; text-align:center; line-height: 27px;"> © Artforsocial all rights reserved </td> </tr> <!-- End of content --> <!-- Spacing --> <tr> <td width="100%" height="27" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <!-- End of Full Text --> </body> </html>'; if ($eq_email) { echo "Error email"; } elseif(!empty($referral_code)){ if(!$eq_code){ echo "Error Code"; } else{ $number_of_people_code_db = $pdo->query("SELECT number_of_people FROM infouser WHERE referral_code = '{$referral_code}'"); $number_of_people_code = $number_of_people_code_db->fetch()["number_of_people"] + 1; $update_number = $pdo->prepare("UPDATE infouser SET number_of_people = $number_of_people_code WHERE referral_code = '{$referral_code}'"); $update_number->execute(); if($number_of_people_code == 2){ $email_with_two_people_DB = $pdo->query("SELECT email FROM infouser WHERE referral_code = '{$referral_code}'"); $email_with_two_people = $email_with_two_people_DB->fetch()["email"]; //______________________________________Referral Email________________________ $mail_referral = new PHPMailer(true); //Recipients $mail_referral->SetFrom('earlysignups.afs@gmail.com'); $mail_referral->addAddress($email_with_two_people); // Add a recipient $mail_referral->addReplyTo('earlysignups.afs@gmail.com', 'Artforsocial'); //Content $mail_referral->isHTML(true); // Set email format to HTML $mail_referral->Subject = 'Artforsocial: congratulations!'; $mail_referral->Body = '<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title>Congratulations</title> <style type="text/css"> /* Client-specific Styles */ div, p, a, li, td { -webkit-text-size-adjust: none; } #outlook a { padding: 0; } /* Force Outlook to provide a "view in browser" menu link. */ html { width: 100%; } body { width: 100% !important; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; margin: 0; padding: 0; } /* Prevent Webkit and Windows Mobile platforms from changing default font sizes, while not breaking desktop design. */ .ExternalClass { width: 100%; } /* Force Hotmail to display emails at full width */ .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { line-height: 100%; } /* Force Hotmail to display normal line spacing. */ #backgroundTable { margin: 0; padding: 0; width: 100% !important; line-height: 100% !important; } img { outline: none; text-decoration: none; border: none; -ms-interpolation-mode: bicubic; } a img { border: none; } .image_fix { display: block; } p { margin: 0px 0px !important; } table td { border-collapse: collapse; } table { border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; } a { color: #33b9ff; text-decoration: none; text-decoration: none !important; } /*STYLES*/ table[class=full] { width: 100%; clear: both; } /*IPAD STYLES*/ @media only screen and (max-width: 640px) { a[href^="tel"], a[href^="sms"] { text-decoration: none; color: #33b9ff; /* or whatever your want */ pointer-events: none; cursor: default; } .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] { text-decoration: default; color: #33b9ff !important; pointer-events: auto; cursor: default; } table[class=devicewidth] { width: 440px !important; text-align: center !important; } table[class=devicewidthinner] { width: 420px !important; text-align: center !important; } } /*IPHONE STYLES*/ @media only screen and (max-width: 480px) { a[href^="tel"], a[href^="sms"] { text-decoration: none; color: #33b9ff; /* or whatever your want */ pointer-events: none; cursor: default; } .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] { text-decoration: default; color: #33b9ff !important; pointer-events: auto; cursor: default; } table[class=devicewidth] { width: 320px !important; text-align: center !important; } table[class=devicewidthinner] { width: 320px !important; text-align: center !important; } td[class=main_title]{ font-size: 40px !important; line-height: 45px !important; } td[class=logo_top]{ height: 30px !important; } td[class=logo_bottom]{ height: 20px !important; } td[class=mobile_30]{ height: 30px !important; } td[class=mobile_25]{ height: 20px !important; } } </style> </head> <body> <!-- start of Full text --> <table width="100%" bgcolor="#fff" cellpadding="0" cellspacing="0" border="0" st-sortable="full-text"> <tbody> <tr> <td> <table width="600" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth"> <tbody> <tr> <td width="100%"> <table bgcolor="#ffffff" width="600" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth"> <tbody> <tr> <td> <table width="445" align="center" cellpadding="0" cellspacing="0" border="0" class="devicewidthinner"> <tbody> <!-- content --> <!-- Spacing --> <tr> <td height="50" class="logo_top" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> <tr> <td align="center" width="100%"> <div class="imgpop" align="center" width="100%"> <a target="_blank" href="http://social-images-landing.techflagman.com/" align="center" style="display: block; width: 100%; text-align: center; margin: 0 auto;"> <img align="center" src="http://social-images-landing.techflagman.com/img/logo.png" alt="logo" border="0" height="51" width="51" style="display:block; border:none; outline:none; text-decoration:none; margin: 0 auto"> </a> </div> </td> </tr> <!-- Spacing --> <tr> <td height="36" class="logo_bottom" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> <tr> <td class="main_title" style="font-family: Arial, sans-serif; font-size: 55px; font-weight: 500; color: #212121; text-align:center; line-height: 63px;"> Congratulations </td> </tr> <!-- End of content --> <!-- Spacing --> <tr> <td width="100%" height="20" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> <!-- content --> <tr> <td class="content_p" style="font-family: Arial, sans-serif; font-weight: 400; font-size: 17px; color: #212121; text-align:center; line-height: 27px;"> Two users signed up using your referral code. An additional <span style="font-weight: 600;">$50 credit</span> has been applied to your email address with Artforsocial. This will be automatically activated when we launch. </td> </tr> <!-- End of content --> <!-- Spacing --> <tr> <td width="100%" height="35" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> <!-- content --> <tr> <td width="100%" align="center"> <div class="main-link" align="center" style="width: 100%; text-align:center; display: inline; margin: 0 auto;"> <a href="https://twitter.com/Artforsocial1" style="display: inline; margin: 0 10px 0 10px;"><img src="http://social-images-landing.techflagman.com/img/twitter.png" alt="twitter" style="display:inline; border:none; outline:none; text-decoration:none;"></a> <a href="https://www.facebook.com/artforsocial" style="display: inline; margin: 0 10px 0 10px;"><img src="http://social-images-landing.techflagman.com/img/facebook.png" alt="twitter" style="display:inline; border:none; outline:none; text-decoration:none;"></a> <a href="https://www.instagram.com/artforsocial" style="display: inline; margin: 0 10px 0 10px;"><img src="http://social-images-landing.techflagman.com/img/instagram.png" alt="twitter" style="display:inline; height: 25px; width: 25px; border-radius: 50%; border:none; outline:none; text-decoration:none;"></a> </div> </td> </tr> <!-- End of content --> <!-- Spacing --> <tr> <td class="mobile_25" width="100%" height="35" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> <!-- Spacing --> <tr> <td width="100%" height="2" style="font-size:1px; line-height:2px; mso-line-height-rule: exactly; background-color: #C7C7C7;"> </td> </tr> <!-- Spacing --> <!-- Spacing --> <tr> <td width="100%" height="28" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> <tr> <td align="center"> <div class="imgpop"> <a target="_blank" href="http://social-images-landing.techflagman.com/"> <img src="http://social-images-landing.techflagman.com/img/logo.png" alt="logo" border="0" height="30" width="30" style="display:block; border:none; outline:none; text-decoration:none; margin: 0 auto"> </a> </div> </td> </tr> <!-- Spacing --> <tr> <td width="100%" height="12" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> <!-- content --> <tr> <td class="content_p" style="font-family: Arial, sans-serif; font-weight: 400; font-size: 15px; color: #909090; text-align:center; line-height: 27px;"> © Artforsocial all rights reserved </td> </tr> <!-- End of content --> <!-- Spacing --> <tr> <td width="100%" height="27" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <!-- End of Full Text --> </body> </html>'; $mail_referral->send(); } $my_Insert_Statement = $pdo->prepare("INSERT INTO infouser (email, number_of_people, referral_code) VALUES ('$email', '$number_of_people', '$referral_code_build')"); $my_Insert_Statement->execute(); $mail->send(); $mail_user->send(); } } else{ $my_Insert_Statement = $pdo->prepare("INSERT INTO infouser (email, number_of_people, referral_code) VALUES ('$email', '$number_of_people', '$referral_code_build')"); $my_Insert_Statement->execute(); $mail->send(); $mail_user->send(); } ?> Save