email-templates-package.php 13 KB
<?php 
function download_email()
{

    $name  = $_REQUEST['name'];
	$company  = $_REQUEST['company'];
	$title  = $_REQUEST['title'];
    $phone = $_REQUEST['phone'];
	$designation  = $_REQUEST['designation'];
	$dir = '/var/www/html/production/fp-canada/current/wp-content/uploads/email_templates/';
	$url = '/wp-content/uploads/email_templates/';

  	ob_start();?>


<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
   <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width,initial-scale=1">
      <meta name="x-apple-disable-message-reformatting">
      <title></title>
      <!--[if mso]>
      <noscript>
         <xml>
            <o:OfficeDocumentSettings>
               <o:PixelsPerInch>96</o:PixelsPerInch>
            </o:OfficeDocumentSettings>
         </xml>
      </noscript>
      <![endif]-->
      <style>
         @font-face { font-family: Calibri;
         src: url('https://yournumbers.ca/wp-content/themes/understrap-child/Calibri.woff') format('woff'); }
         @font-face { font-family: Calibri-bold;
         src: url('https://yournumbers.ca/wp-content/themes/understrap-child/Calibri-Bold.woff') format('woff'); }
         table, td, div, h1, p {font-family: Calibri;}
         strong{font-family: Calibri;}
      </style>
   </head>
   <body style="margin:0;padding:0;max-width: 600px;">
      <table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;background:#ffffff;">
         <tr>
            <td align="center" style="padding:0;">
				<table role="presentation" style="width:602px;border-collapse:collapse;border-spacing:0;text-align:left;">
                  <tr style="background-image:url('https://yournumbers.ca/wp-content/uploads/2022/02/Group-1061@2x.png'); height: 400px;background-size: cover;">
                     <td colspan="4" style="padding:36px 30px 0px 30px;">
                        <table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;">
							<tr>
								<td style="padding:0 0 36px 0;color:#153643;height: 150px;">
									&nbsp; 
								</td>
							 </tr>
                           <tr>
                              <td style="padding: 0 0 0px 0;color:#153643;">
                                 <h1 style="font-size:50px;line-height:55px;color:#012169;margin:0 0 20px 0; font-family: Calibri-bold;">
									<br>
									HOW MUCH BETTER CAN<br>TOMORROW LOOK?
                                 </h1>
                              </td>
                           </tr>
                        </table>
                     </td>
                  </tr>
				  <tr style="background:#ffffff;">
					<td colspan="4" style="padding:36px 30px 42px 30px;">
					   <table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;">
						  <tr>
							 <td colspan="3" style="padding:0 0 36px 0;color:#153643;">
								<p style="margin:0 0 12px 0;font-size:16px;line-height:20px;font-family: Calibri;color:#5B6770;">FP Canada™ survey results show Canadian consumers like you experience 16% less financial stress* when they work with a financial planning professional. It’s a nice number. But what does that look like for you? Maybe you sleep better. Or you and your life partner sing more from the same song sheet and harmony blossoms. Whatever reduced stress looks like for you, it is achievable today. And here’s another number: You’ll also have 17% more financial confidence in the future. That’s you, boldly looking ahead with a big smile.</p>
								<p style="margin:0 0 12px 0;font-size:16px;line-height:20px;font-family: Calibri-bold;color:#012169;">The easiest way to realize the stress-busting, confidence-boosting benefits of professional financial planning is to start with one simple number. Talk to me today and see how your future adds up!</p>
							
							 </td>
						  </tr>
						  <tr>
							<td align="left" width="90" style="border-right: #012169  1px solid;padding-top:10px;">
							   <?php if( $designation == 'CFP') { ?>
								    <img width="68" src="https://yournumbers.ca/wp-content/uploads/2022/02/Group-1027@2x.png" class="img-fluid">
								<?php }else{ ?>	
									<img width="68" src="https://yournumbers.ca/wp-content/uploads/2022/02/Group-1026@2x.png" class="img-fluid">
								<?php }?>		
							</td>
							<td colspan="2" align="left" style="padding-left:20px;">
							   <?php echo  $name.'<br>';?>
								<?php if($company !="" || $title !=""){
								 echo $title.' '.$company.'<br>';
								 } ?>
								<?php echo $phone;?>
							</td>
						
						 </tr>
						 <tr style="background:#ffffff;">
							<td align="left" colspan="4" style="padding-bottom:40px">
								&nbsp; 
							</td>
						</tr>
						 <tr style="background:#ffffff;">
							<td align="left" colspan="4" style="padding-bottom:10px">
								<p style="margin:0;font-size:20px;line-height:22px;font-family:Calibri;color:#5B6770;">Want to learn more about how easy it is to get started? Watch this video, pick a number and then let’s chat.</a></p>
							</td>
						</tr>
						  <tr style="background:#ffffff;">
							 <td align="center" colspan="4" style="padding-bottom:10px">
									<a href="https://youtu.be/KFcLr1zngS0">
										<img width="533" src="https://yournumbers.ca/wp-content/uploads/2022/02/Group-1060@2x.png"/>
									</a>	
							 </td>
						  </tr>
						  <tr style="background:#ffffff;">
							<td align="left" colspan="4" style="color:#5B6770;font: normal normal normal 12px/14px Calibri;padding-bottom:10px">
						  			* Source: 2021 FP Canada Financial Stress Index.<br>
								  <?php if( $designation != 'CFP') { ?> 
									QAFP™ is a certification mark of FP Canada. Used under license.
								<?php }else{ ?>	
                                    CFP®, Certified Financial Planner® and CFP logo are trademarks owned by Financial Planning Standards Board Ltd. (FPSB) and used under license. © 2022 FP Canada™. All rights reserved.
								<?php }?>			
						  </td>
						  </tr>
					   </table>
					</td>
				 </tr>
			  </table>
			  </td>
			  </tr>
        </table>
           
   </body>
</html>

<?php   

$body = ob_get_clean();
file_put_contents($dir.'email_1_'.$name.'_'.date("m-d-y-H-i-s").".html", $body );

$file1 = $dir.'email_1_'.$name.'_'.date("m-d-y-H-i-s").".html";

ob_start();?>

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
   <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width,initial-scale=1">
      <meta name="x-apple-disable-message-reformatting">
      <title></title>
      <!--[if mso]>
      <noscript>
         <xml>
            <o:OfficeDocumentSettings>
               <o:PixelsPerInch>96</o:PixelsPerInch>
            </o:OfficeDocumentSettings>
         </xml>
      </noscript>
      <![endif]-->
      <style>
         @font-face { font-family: Calibri;
         src: url('https://yournumbers.ca/wp-content/themes/understrap-child/Calibri.woff') format('woff'); }
         @font-face { font-family: Calibri-bold;
         src: url('https://yournumbers.ca/wp-content/themes/understrap-child/Calibri-Bold.woff') format('woff'); }
         table, td, div, h1, p {font-family: Calibri;}
         strong{font-family: Calibri;}
      </style>
   </head>
   <body style="margin:0;padding:0;max-width: 600px;">
      <table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;background:#ffffff;">
         <tr>
            <td align="center" style="padding:0;">
				<table role="presentation" style="width:602px;border-collapse:collapse;border-spacing:0;text-align:left;">
                  <tr style="background-image:url('https://yournumbers.ca/wp-content/uploads/2022/02/FP_WYN-Shy-Woman-1_F@2x.png'); height: 400px;background-size: cover;">
                     <td colspan="4" style="padding:36px 30px 0px 30px;">
                        <table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;">
							<tr>
								<td style="padding:0 0 36px 0;color:#153643;height: 100px;">
									&nbsp; 
								</td>
							 </tr>
                           <tr>
                              <td style="padding: 0 0 70px 0;color:#fff;">
                                 <h1 style="font-size:50px;line-height:55px;color:#fff;margin:0 0 20px 0; font-family: Calibri-bold;">
									<br>
									DON’T BE SHY.<br>EVERYONE HAS ONE.
                                 </h1>
                              </td>
                           </tr>
                        </table>
                     </td>
                  </tr>
				  <tr style="background:#ffffff;">
					<td colspan="4" style="padding:36px 30px 42px 30px;">
					   <table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;">
						  <tr>
							 <td colspan="3" style="padding:0 0 36px 0;color:#153643;">
								<p style="margin:0 0 12px 0;font-size:16px;line-height:20px;font-family: Calibri;color:#5B6770;">You’ve been using simple numbers to map your journey through life forever. From the birthdate your Mom never forgets to the street number on your new home to the mortgage number that you pay monthly. Numbers are simple signposts. So let’s think about your financial well-being in the context of simple numbers. Pick just one. One number that is important to you and we’ll use that as a starting point for a financial plan. We’ll connect your numbers together and we’ll adapt whenever life says you should. It’s an easy way to reduce stress and build financial confidence in your future. And you can start or expand your plan with me today.</p>
								<p style="margin:0 0 12px 0;font-size:16px;line-height:20px;font-family: Calibri-bold;color:#012169;">The easiest way to realize the stress-busting, confidence-boosting benefits of professional financial planning is to start with one simple number. Talk to me today and see how your future adds up!</p>
							
							 </td>
						  </tr>
						  <tr>
							<td align="left" width="90" style="border-right: #012169  1px solid;padding-top:10px;">
								<?php if( $designation == 'CFP') { ?>
								    <img width="68" src="https://yournumbers.ca/wp-content/uploads/2022/02/Group-1027@2x.png" class="img-fluid">
								<?php }else{ ?>	
									<img width="68" src="https://yournumbers.ca/wp-content/uploads/2022/02/Group-1026@2x.png" class="img-fluid">
								<?php }?>			
							</td>
							<td colspan="2" align="left" style="padding-left:20px;">
							   <?php echo  $name.'<br>';?>
								<?php if($company !="" || $title !=""){
								 echo $title.' '.$company.'<br>';
								 } ?>
								<?php echo $phone;?>
							</td>
						
						 </tr>
						 <tr style="background:#ffffff;">
							<td align="left" colspan="4" style="padding-bottom:40px">
								&nbsp; 
							</td>
						</tr>
						 <tr style="background:#ffffff;">
							<td align="left" colspan="4" style="padding-bottom:10px">
								<p style="margin:0;font-size:20px;line-height:22px;font-family:Calibri;color:#5B6770;">Want to learn more about how easy it is to get started? Watch this video, pick a number and then let’s chat.</a></p>
							</td>
						</tr>
						  <tr style="background:#ffffff;">
							 <td align="center" colspan="4" style="padding-bottom:10px">
								<a href="https://youtu.be/KFcLr1zngS0">
										<img width="533" src="https://yournumbers.ca/wp-content/uploads/2022/02/Group-1060@2x-1.png"/>
								</a>		
							 </td>
						  </tr>
						  <tr style="background:#ffffff;">
							<td align="left" colspan="4" style="color:#5B6770;font: normal normal normal 12px/14px Calibri;padding-bottom:10px">
						  		  * Source: 2021 FP Canada Financial Stress Index.<br>
								  <?php if( $designation != 'CFP') { ?> 
									QAFP™ is a certification mark of FP Canada. Used under license.
								<?php }else{ ?>	
                                    CFP®, Certified Financial Planner® and CFP logo are trademarks owned by Financial Planning Standards Board Ltd. (FPSB) and used under license. © 2022 FP Canada™. All rights reserved.
								<?php }?>			
						  </td>
						  </tr>
					   </table>
					</td>
				 </tr>
			  </table>
			  </td>
			  </tr>
        </table>
           
   </body>
</html>


<?php
$body_customer = ob_get_clean();  

file_put_contents($dir.'email_2_'.$name.'_'.date("m-d-y-H-i-s").".html", $body_customer );

$file2 = $dir.'email_2_'.$name.'_'.date("m-d-y-H-i-s").".html";


$zip = new ZipArchive;
if ($zip->open($dir.$name.'_'.date("m-d-y-H-i-s").'.zip', ZipArchive::CREATE) === TRUE)
{
    // Add file to the zip file
    $zip->addFile($file1, 'email_1.html');
    $zip->addFile($file2, 'email_2.html');
 
    // All files are added, so close the zip file.
    $zip->close();
}


$result['file'] = $url.$name.'_'.date("m-d-y-H-i-s").'.zip';
$result['success'] = true;
  

unlink($file1);
unlink($file2);

wp_send_json_success($result);

die;
}
				  
add_action("wp_ajax_nopriv_download_email", "download_email");
add_action("wp_ajax_download_email", "download_email");