Advertisement
vdp

Untitled

vdp
Jul 31st, 2018
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.14 KB | None | 0 0
  1. <?php
  2. use PHPMailer\PHPMailer\PHPMailer;
  3. use PHPMailer\PHPMailer\Exception;
  4. $uri_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
  5. $uri_segments = explode('/', $uri_path);
  6. if($uri_segments[2]=="customer"){
  7.   require ('../vendor/autoload.php');
  8.   require ('../vendor/phpmailer/phpmailer/src/Exception.php');
  9.   require ('../vendor/phpmailer/phpmailer/src/PHPMailer.php');
  10.   require ('../vendor/phpmailer/phpmailer/src/SMTP.php');
  11. }else{
  12.   require ('vendor/autoload.php');
  13.   require ('vendor/phpmailer/phpmailer/src/Exception.php');
  14.   require ('vendor/phpmailer/phpmailer/src/PHPMailer.php');
  15.   require ('vendor/phpmailer/phpmailer/src/SMTP.php');
  16. }
  17.  
  18. function sendMail($customer_email,$title,$body,$name){
  19. $mail = new PHPMailer(true);                              // Passing `true` enables exceptions
  20.   try {
  21.       //Server settings
  22.       $mail->SMTPDebug = 2;                                 // Enable verbose debug output
  23.       $mail->isSMTP();                                      // Set mailer to use SMTP
  24.       $mail->Host = 'smtp.gmail.com';  // Specify main and backup SMTP servers
  25.       $mail->SMTPAuth = true;                               // Enable SMTP authentication
  26.       $mail->Username = 'volutionshop@gmail.com';                 // SMTP username
  27.       $mail->Password = 'komengku';                           // SMTP password
  28.       $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
  29.       $mail->Port = 587;                                    // TCP port to connect to
  30.  
  31.       $mail->setFrom('volutionshop@gmail.com', 'Volution Admin');
  32.       $mail->addAddress($customer_email, 'Customer');
  33.  
  34.       $mail->Subject = $title;
  35.       $mail->isHTML(true);
  36.       $server = $_SERVER['SERVER_NAME'];
  37.       $mail->Body = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'
  38.            'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
  39.            <html xmlns='http://www.w3.org/1999/xhtml'>
  40.            <head>
  41.              <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
  42.              <title>Banned Account</title>
  43.              <meta name='viewport' content='width=device-width, initial-scale=1.0'/>
  44.            </head>
  45.            <body style='margin:0; padding:10px 0 0 0;' bgcolor='#F8F8F8'>
  46.              <table align='center' border='0' cellpadding='0' cellspacing='0' width='95%'>
  47.                <tr>
  48.                  <td align='center'>
  49.                    <table align='center' border='0' cellpadding='0' cellspacing='0' width='600'
  50.                    style='border-collapse: separate; border-spacing: 2px 5px; box-shadow: 1px 0 1px 1px #B8B8B8;'
  51.                    bgcolor='#ffffff'>
  52.                    <tr>
  53.                      <td align='center' style='padding: 5px 5px 5px 5px;color: white;' bgcolor='#FF3232'>
  54.                        <a href='http://$server' target='_blank'>
  55.                          <img src='https://lh4.googleusercontent.com/zxQEAef4T610ttKs2U1trS0nO4KSufD7K5lC5t_HYkLleGWZc-_nZOOhFCdYU5QOdqLXxSC4CI-I05f05piO=w1366-h635' style='width:20%;border:0;margin-top:10px'/>
  56.                        </a>
  57.                      </td>
  58.                    </tr>
  59.                    <tr>
  60.                      <td bgcolor='#ffffff' style='padding: 40px 30px 40px 30px;'>
  61.                        <table border='0' cellpadding='0' cellspacing='0' width='100%%'>
  62.                          <tr>
  63.                            <td style='padding: 10px 0 10px 0; font-family: Avenir, sans-serif; font-size: 16px;text-align:justify;color:black;'>
  64.                              <!-- Initial text goes here-->
  65.                              <b><p>Hi $name,</p></b><br>
  66.                              $body
  67.                              <p>Best Regards,</p><br>
  68.                              <p>Volution Shop</p>
  69.                            </td>
  70.                          </tr>
  71.                        </table>
  72.                      </td>
  73.                    </tr>
  74.                    <tr>
  75.                      <td bgcolor='#E8E8E8'>
  76.                        <table border='0' cellpadding='0' cellspacing='0' width='100%%' style='padding: 20px 10px 10px 10px;'>
  77.                          <tr>
  78.                            <td width='260' valign='top' style='padding: 0 0 15px 0;'>
  79.                              <table border='0' cellpadding='0' cellspacing='0' width='100%%'>
  80.                                <tr>
  81.                                  <td align='center'>
  82.                                    <a href='tel:+6287700896356' target='_blank'>
  83.                                      <img src='https://lh6.googleusercontent.com/wnQhYWy5F4vDHBNtfSEf0CH1UNbY64w0uLoG2EltDhgEnyLjsetFxnayTzX_ZKidQ0Yv8Q6r8NhTodTBFDOY=w1366-h586' alt='Call us'
  84.                                      style='display: block;height: 50px;width:50px'/>
  85.                                    </a>
  86.                                  </td>
  87.                                </tr>
  88.                                <tr>
  89.                                  <td align='center'
  90.                                  style='font-family: Avenir, sans-serif; color:#707070;font-size: 13px;padding: 10px 0 0 0;'>
  91.                                  GIVE US A CALL
  92.                                </td>
  93.                              </tr>
  94.                            </table>
  95.                          </td>
  96.                          <td style='font-size: 0; line-height: 0;' width='20'>
  97.                            &nbsp;
  98.                          </td>
  99.                          <td width='260' valign='top' style='padding: 0 0 15px 0;'>
  100.                            <table border='0' cellpadding='0' cellspacing='0' width='100%%' >
  101.                              <tr>
  102.                                <td align='center'>
  103.                                  <a href='mailto:volutionshop@gmail.com'>
  104.                                    <img src='https://lh3.googleusercontent.com/D24K7rQFCRpE2owT1WBMNHYP0kMco_XuVM9I1ZAmhe3M5NQu5rdU6bz4IWjrnnXB93EgfceZiszCFylpAMb0=w1366-h586' alt='Call us'
  105.                                    style='display: block;height: 50px;width:50px'/>
  106.                                  </a>
  107.                                </td>
  108.                              </tr>
  109.                              <tr>
  110.                                <td align='center'
  111.                                style='font-family: Avenir, sans-serif; color:#707070;font-size: 13px;padding: 10px 0 0 0;'>
  112.                                EMAIL US
  113.                              </td>
  114.                            </tr>
  115.                          </table>
  116.                        </td>
  117.                        <td style='font-size: 0; line-height: 0;' width='20'>
  118.                          &nbsp;
  119.                        </td>
  120.                    </tr>
  121.                  </table>
  122.                </td>
  123.              </tr>
  124.            </table>
  125.            </td>
  126.            </tr>
  127.            </table>
  128.            </body>
  129.            </html>
  130.            ";
  131.       $mail->send();
  132.       echo 'Message has been sent';
  133.   } catch (Exception $e) {
  134.       echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
  135.   }
  136. }
  137.  
  138. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement