Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
28 kB
4
Indexable
	public static function send_coupon_email($couponcode){

		// Address to send mail to
		$sanitized_email = sanitize_email($_POST['woofirstpurchaseemail']);

		// Mail Headers
		$email_subject = esc_html(get_option('woofirstpurchase_emailsubject_setting', __('You won a coupon!','woocommerce_first_purchase')));
		$custom_name = esc_html(get_option('woofirstpurchase_customname_setting', 'The Coupon Company'));
		$custom_email = esc_html(get_option('woofirstpurchase_customemail_setting', 'prizes@yourwebsite.com'));
		$headers = 'From: "'.$custom_name.'"<' . $custom_email . '>' . "\r\n";

		// Email Message
		if (get_option('woofirstpurchase_email_template_setting','second') === 'second'){
			ob_start();
			?>
			<!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:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml">
			<head>
			<!--[if gte mso 9]><xml><o:OfficeDocumentSettings><o:AllowPNG/><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]-->
			<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
			<meta content="width=device-width" name="viewport"/>
			<!--[if !mso]><!-->
			<meta content="IE=edge" http-equiv="X-UA-Compatible"/>
			<!--<![endif]-->
			<title></title>
			<!--[if !mso]><!-->
			<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css"/>
			<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css"/>
			<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css"/>
			<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css"/>
			<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css"/>
			<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css"/>
			<!--<![endif]-->
			<style type="text/css">
					body {
						margin: 0;
						padding: 0;
					}

					table,
					td,
					tr {
						vertical-align: top;
						border-collapse: collapse;
					}

					* {
						line-height: inherit;
					}

					a[x-apple-data-detectors=true] {
						color: inherit !important;
						text-decoration: none !important;
					}
				</style>
			<style id="media-query" type="text/css">
					@media (max-width: 670px) {

						.block-grid,
						.col {
							min-width: 320px !important;
							max-width: 100% !important;
							display: block !important;
						}

						.block-grid {
							width: 100% !important;
						}

						.col {
							width: 100% !important;
						}

						.col>div {
							margin: 0 auto;
						}

						img.fullwidth,
						img.fullwidthOnMobile {
							max-width: 100% !important;
						}

						.no-stack .col {
							min-width: 0 !important;
							display: table-cell !important;
						}

						.no-stack.two-up .col {
							width: 50% !important;
						}

						.no-stack .col.num4 {
							width: 33% !important;
						}

						.no-stack .col.num8 {
							width: 66% !important;
						}

						.no-stack .col.num4 {
							width: 33% !important;
						}

						.no-stack .col.num3 {
							width: 25% !important;
						}

						.no-stack .col.num6 {
							width: 50% !important;
						}

						.no-stack .col.num9 {
							width: 75% !important;
						}

						.video-block {
							max-width: none !important;
						}

						.mobile_hide {
							min-height: 0px;
							max-height: 0px;
							max-width: 0px;
							display: none;
							overflow: hidden;
							font-size: 0px;
						}

						.desktop_hide {
							display: block !important;
							max-height: none !important;
						}
					}
				</style>
			</head>
			<body class="clean-body" style="margin: 0; padding: 0; -webkit-text-size-adjust: 100%; background-color: #F6F5FF;">
			<!--[if IE]><div class="ie-browser"><![endif]-->
			<table bgcolor="#F6F5FF" cellpadding="0" cellspacing="0" class="nl-container" role="presentation" style="table-layout: fixed; vertical-align: top; min-width: 320px; Margin: 0 auto; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background-color: #F6F5FF; width: 100%;" valign="top" width="100%">
			<tbody>
			<tr style="vertical-align: top;" valign="top">
			<td style="word-break: break-word; vertical-align: top;" valign="top">
			<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" style="background-color:#F6F5FF"><![endif]-->
			<div style="background-color:transparent;">
			<div class="block-grid" style="Margin: 0 auto; min-width: 320px; max-width: 650px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">
			<div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">
			<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:650px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->
			<!--[if (mso)|(IE)]><td align="center" width="650" style="background-color:transparent;width:650px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 20px; padding-left: 20px; padding-top:25px; padding-bottom:25px;"><![endif]-->
			<div class="col num12" style="min-width: 320px; max-width: 650px; display: table-cell; vertical-align: top; width: 650px;">
			<div style="width:100% !important;">
			<!--[if (!mso)&(!IE)]><!-->
			<div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:25px; padding-bottom:25px; padding-right: 20px; padding-left: 20px;">
			<!--<![endif]-->
			<div align="center" class="img-container center autowidth" style="padding-right: 5px;padding-left: 5px;">
			<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr style="line-height:0px"><td style="padding-right: 5px;padding-left: 5px;" align="center"><![endif]-->
			<div style="font-size:1px;line-height:5px"> </div><a href="{shoppageurl}" style="outline:none" tabindex="-1" target="_blank"> <img align="center" alt="Logo" border="0" class="center autowidth" src="{logoimagelink}" style="text-decoration: none; -ms-interpolation-mode: bicubic; height: auto; border: none; width: 100%; width: {logowidth}px; max-width: 500px; display: block;" title="Logo" width="{logowidth}"/></a>
			<div style="font-size:1px;line-height:5px"> </div>
			<!--[if mso]></td></tr></table><![endif]-->
			</div>
			<!--[if (!mso)&(!IE)]><!-->
			</div>
			<!--<![endif]-->
			</div>
			</div>
			<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
			<!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->
			</div>
			</div>
			</div>
			<div style="background-color:transparent;">
			<div class="block-grid" style="Margin: 0 auto; min-width: 320px; max-width: 650px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">
			<div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">
			<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:650px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->
			<!--[if (mso)|(IE)]><td align="center" width="650" style="background-color:transparent;width:650px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:0px; padding-bottom:0px;"><![endif]-->
			<div class="col num12" style="min-width: 320px; max-width: 650px; display: table-cell; vertical-align: top; width: 650px;">
			<div style="width:100% !important;">
			<!--[if (!mso)&(!IE)]><!-->
			<div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:0px; padding-bottom:0px; padding-right: 0px; padding-left: 0px;">
			<!--<![endif]-->
			<div align="center" class="img-container center autowidth fullwidth">
			<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr style="line-height:0px"><td style="" align="center"><![endif]--><img align="center" alt="Image" border="0" class="center autowidth fullwidth" src="{topimagelink}" style="text-decoration: none; -ms-interpolation-mode: bicubic; border: 0; height: auto; width: 100%; max-width: 650px; display: block;" title="Image" width="650"/>
			<!--[if mso]></td></tr></table><![endif]-->
			</div>
			<!--[if (!mso)&(!IE)]><!-->
			</div>
			<!--<![endif]-->
			</div>
			</div>
			<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
			<!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->
			</div>
			</div>
			</div>
			<div style="background-color:transparent;">
			<div class="block-grid" style="Margin: 0 auto; min-width: 320px; max-width: 650px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: #9d439c;">
			<div style="border-collapse: collapse;display: table;width: 100%;background-color:#9d439c;background-image:url('{backgroundimagelink}');background-position:top left;background-repeat:no-repeat">
			<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:650px"><tr class="layout-full-width" style="background-color:#9d439c"><![endif]-->
			<!--[if (mso)|(IE)]><td align="center" width="650" style="background-color:#9d439c;width:650px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 30px; padding-left: 30px; padding-top:25px; padding-bottom:30px;"><![endif]-->
			<div class="col num12" style="min-width: 320px; max-width: 650px; display: table-cell; vertical-align: top; width: 650px;">
			<div style="width:100% !important;">
			<!--[if (!mso)&(!IE)]><!-->
			<div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:25px; padding-bottom:30px; padding-right: 30px; padding-left: 30px;">
			<!--<![endif]-->
			<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 10px; padding-left: 10px; padding-top: 10px; padding-bottom: 5px; font-family: Arial, sans-serif"><![endif]-->
			<div style="color:#B1AED1;font-family:Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;line-height:1.2;padding-top:10px;padding-right:10px;padding-bottom:5px;padding-left:10px;">
			<div style="font-size: 16px; line-height: 1.2; font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif; color: #B1AED1; mso-line-height-alt: 19px;">
			<p style="font-size: 20px; line-height: 1.2; text-align: center; word-break: break-word; font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif; mso-line-height-alt: 24px; margin: 0;"><span style="font-size: 20px;">{emailtopline}</span></p>
			</div>
			</div>
			<!--[if mso]></td></tr></table><![endif]-->
			<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 0px; padding-bottom: 5px; font-family: Tahoma, Verdana, sans-serif"><![endif]-->
			<div style="color:#ffffff;font-family:'Roboto', Tahoma, Verdana, Segoe, sans-serif;line-height:1.2;padding-top:0px;padding-right:5px;padding-bottom:5px;padding-left:5px;">
			<div style="line-height: 1.2; font-family: 'Roboto', Tahoma, Verdana, Segoe, sans-serif; font-size: 12px; color: #ffffff; mso-line-height-alt: 14px;">
			<p style="line-height: 1.2; text-align: center; font-size: 38px; word-break: break-word; font-family: Roboto, Tahoma, Verdana, Segoe, sans-serif; mso-line-height-alt: 46px; margin: 0;"><span style="font-size: 38px;">{emailmainheading}</span></p>
			</div>
			</div>
			<!--[if mso]></td></tr></table><![endif]-->
			<div align="center" class="button-container" style="padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px;">
			<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-spacing: 0; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;"><tr><td style="padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px" align="center"><v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="#" style="height:27pt; width:210.75pt; v-text-anchor:middle;" arcsize="139%" stroke="false" fillcolor="#f7a40c"><w:anchorlock/><v:textbox inset="0,0,0,0"><center style="color:#ffffff; font-family:Arial, sans-serif; font-size:15px"><![endif]--><a href="{shoppageurl}" style="-webkit-text-size-adjust: none; text-decoration: none; display: inline-block; color: #ffffff; background-color: #f7a40c; border-radius: 50px; -webkit-border-radius: 50px; -moz-border-radius: 50px; width: auto; width: auto; border-top: 1px solid #f7a40c; border-right: 1px solid #f7a40c; border-bottom: 1px solid #f7a40c; border-left: 1px solid #f7a40c; padding-top: 0px; padding-bottom: 0px; font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; text-align: center; mso-border-alt: none; word-break: keep-all;" target="_blank"><span style="padding-left:25px;padding-right:25px;font-size:15px;display:inline-block;"><span style="font-size: 16px; line-height: 2; word-break: break-word; font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; mso-line-height-alt: 32px;"><span data-mce-style="font-size: 15px; line-height: 30px;" style="font-size: 15px; line-height: 30px;"><strong>COUPON CODE:</strong> </span><span data-mce-style="font-size: 18px; line-height: 36px;" style="font-size: 18px; line-height: 36px;"><strong><span data-mce-style="line-height: 32px;" style="line-height: 32px;">{couponcode}</span></strong></span></span></span></a>
			<!--[if mso]></center></v:textbox></v:roundrect></td></tr></table><![endif]-->
			</div>
			<div align="center" class="img-container center fixedwidth" style="padding-right: 0px;padding-left: 0px;">
			<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr style="line-height:0px"><td style="padding-right: 0px;padding-left: 0px;" align="center"><![endif]--><img align="center" alt="Image" border="0" class="center fixedwidth" src="{couponimagelink}" style="text-decoration: none; -ms-interpolation-mode: bicubic; border: 0; height: auto; width: 100%; max-width: 383px; display: block;" title="Image" width="383"/>
			<!--[if mso]></td></tr></table><![endif]-->
			</div>
			<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 10px; padding-bottom: 10px; font-family: Arial, sans-serif"><![endif]-->
			<div style="color:#ffffff;font-family:Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;line-height:1.5;padding-top:10px;padding-right:5px;padding-bottom:10px;padding-left:5px;">
			<div style="font-size: 14px; line-height: 1.5; font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif; color: #ffffff; mso-line-height-alt: 21px;">
			<p style="font-size: 14px; line-height: 1.5; text-align: center; word-break: break-word; font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif; mso-line-height-alt: 21px; margin: 0;"><strong><span style="font-size: 17px; mso-ansi-font-size: 18px;">{emailmiddleline}</span></strong></p>
			<p style="font-size: 14px; line-height: 1.5; text-align: center; word-break: break-word; font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif; mso-line-height-alt: 21px; margin: 0;"><strong><span style="font-size: 17px; mso-ansi-font-size: 18px;">{emailbottomline}</span></strong></p>
			</div>
			</div>
			<!--[if mso]></td></tr></table><![endif]-->
			<div align="center" class="button-container" style="padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px;">
			<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-spacing: 0; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;"><tr><td style="padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px" align="center"><v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="#" style="height:31.5pt; width:243.75pt; v-text-anchor:middle;" arcsize="120%" stroke="false" fillcolor="#f7a40c"><w:anchorlock/><v:textbox inset="0,0,0,0"><center style="color:#ffffff; font-family:Arial, sans-serif; font-size:16px"><![endif]--><a href="{shoppageurl}" style="-webkit-text-size-adjust: none; text-decoration: none; display: inline-block; color: #ffffff; background-color: #f7a40c; border-radius: 50px; -webkit-border-radius: 50px; -moz-border-radius: 50px; width: auto; width: auto; border-top: 1px solid #f7a40c; border-right: 1px solid #f7a40c; border-bottom: 1px solid #f7a40c; border-left: 1px solid #f7a40c; padding-top: 5px; padding-bottom: 5px; font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; text-align: center; mso-border-alt: none; word-break: keep-all;" target="_blank"><span style="padding-left:40px;padding-right:40px;font-size:16px;display:inline-block;"><span style="font-size: 16px; line-height: 2; word-break: break-word; font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; mso-line-height-alt: 32px;"><strong>{emailbuttontext}</strong></span></span></a>
			<!--[if mso]></center></v:textbox></v:roundrect></td></tr></table><![endif]-->
			</div>
			<!--[if (!mso)&(!IE)]><!-->
			</div>
			<!--<![endif]-->
			</div>
			</div>
			<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
			<!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->
			</div>
			</div>
			</div>
			<div style="background-color:transparent;">
			<div class="block-grid" style="Margin: 0 auto; min-width: 320px; max-width: 650px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">
			<div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">
			<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:650px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->
			<!--[if (mso)|(IE)]><td align="center" width="650" style="background-color:transparent;width:650px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:0px; padding-bottom:0px;"><![endif]-->
			<div class="col num12" style="min-width: 320px; max-width: 650px; display: table-cell; vertical-align: top; width: 650px;">
			<div style="width:100% !important;">
			<!--[if (!mso)&(!IE)]><!-->
			<div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:0px; padding-bottom:0px; padding-right: 0px; padding-left: 0px;">
			<!--<![endif]-->
			<div align="center" class="img-container center autowidth fullwidth" style="padding-right: 0px;padding-left: 0px;">
			<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr style="line-height:0px"><td style="padding-right: 0px;padding-left: 0px;" align="center"><![endif]--><img align="center" alt="Image" border="0" class="center autowidth fullwidth" src="{bottomimagelink}" style="text-decoration: none; -ms-interpolation-mode: bicubic; border: 0; height: auto; width: 100%; max-width: 650px; display: block;" title="Image" width="650"/>
			<!--[if mso]></td></tr></table><![endif]-->
			</div>
			<!--[if (!mso)&(!IE)]><!-->
			</div>
			<!--<![endif]-->
			</div>
			</div>
			<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
			<!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->
			</div>
			</div>
			</div>
			<div style="background-color:transparent;">
			<div class="block-grid" style="Margin: 0 auto; min-width: 320px; max-width: 650px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">
			<div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">
			<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:650px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->
			<!--[if (mso)|(IE)]><td align="center" width="650" style="background-color:transparent;width:650px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->
			<div class="col num12" style="min-width: 320px; max-width: 650px; display: table-cell; vertical-align: top; width: 650px;">
			<div style="width:100% !important;">
			<!--[if (!mso)&(!IE)]><!-->
			<div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">
			<!--<![endif]-->
			<table border="0" cellpadding="0" cellspacing="0" class="divider" role="presentation" style="table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; min-width: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;" valign="top" width="100%">
			<tbody>
			<tr style="vertical-align: top;" valign="top">
			<td class="divider_inner" style="word-break: break-word; vertical-align: top; min-width: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px;" valign="top">
			<table align="center" border="0" cellpadding="0" cellspacing="0" class="divider_content" height="0" role="presentation" style="table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-top: 0px solid transparent; height: 0px; width: 100%;" valign="top" width="100%">
			<tbody>
			<tr style="vertical-align: top;" valign="top">
			<td height="0" style="word-break: break-word; vertical-align: top; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;" valign="top"><span></span></td>
			</tr>
			</tbody>
			</table>
			</td>
			</tr>
			</tbody>
			</table>
			<!--[if (!mso)&(!IE)]><!-->
			</div>
			<!--<![endif]-->
			</div>
			</div>
			<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
			<!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->
			</div>
			</div>
			</div>
			<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
			</td>
			</tr>
			</tbody>
			</table>
			<!--[if (IE)]></div><![endif]-->
			</body>
			</html>
			<?php
			$template = ob_get_clean();
			$email_message = $template;

			$bottomimagelink = plugins_url('emails/images/bottom.png', __FILE__);
			$topimagelink = plugins_url('emails/images/top.png', __FILE__);
			$backgroundimagelink = plugins_url('emails/images/background.jpg', __FILE__);
			$couponimagelink = plugins_url('emails/images/coupon.png', __FILE__);
			$logoimagelink = get_option('woofirstpurchase_logo_setting','');
			$shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) );

			$emailtopline = esc_html(get_option('woofirstpurchase_email_top_line_text_setting', __('THANK YOU FOR SIGNING UP','woocommerce-first-purchase')));
			$emailmainheading = esc_html(get_option('woofirstpurchase_email_main_heading_text_setting', __('Enjoy a $25 Discount','woocommerce-first-purchase')));
			$emailmiddleline = esc_html(get_option('woofirstpurchase_email_middle_line_text_setting', __('Here\'s an exclusive coupon to help you with your first purchase.','woocommerce-first-purchase')));
			$emailbottomline = esc_html(get_option('woofirstpurchase_email_bottom_line_text_setting', __('Thank you for shopping with us.','woocommerce-first-purchase')));
			$emailbuttontext = esc_html(get_option('woofirstpurchase_email_button_text_setting', __('Get started right now.','woocommerce-first-purchase')));
			$email_message = str_replace("{emailtopline}",$emailtopline, $email_message);
			$email_message = str_replace("{emailmainheading}",$emailmainheading, $email_message);
			$email_message = str_replace("{emailmiddleline}",$emailmiddleline, $email_message);
			$email_message = str_replace("{emailbottomline}",$emailbottomline, $email_message);
			$email_message = str_replace("{emailbuttontext}",$emailbuttontext, $email_message);

			$email_message = str_replace("{bottomimagelink}", $bottomimagelink, $email_message);
			$email_message = str_replace("{topimagelink}", $topimagelink, $email_message);
			$email_message = str_replace("{backgroundimagelink}", $backgroundimagelink, $email_message);
			$email_message = str_replace("{couponimagelink}", $couponimagelink, $email_message);
			if (logoimagelink !== ''){
				$email_message = str_replace("{logoimagelink}", $logoimagelink, $email_message);
				$logowidth = wp_get_attachment_image_src(attachment_url_to_postid($logoimagelink), 'full')[1];
				$email_message = str_replace("{logowidth}", $logowidth, $email_message);
			} else {
				$email_message = str_replace("{logoimagelink}", '#', $email_message);
			}
			$email_message = str_replace("{couponcode}", $couponcode, $email_message);
			$email_message = str_replace("{email}",$sanitized_email,$email_message);
			$email_message = str_replace("{shoppageurl}",$shop_page_url, $email_message);
		} else if (get_option('woofirstpurchase_email_template_setting','second') === 'first'){
			$email_message = esc_html(get_option('woofirstpurchase_email_top_line_text_setting', __('THANK YOU FOR SIGNING UP','woocommerce-first-purchase'))).'<br><br>'.esc_html(get_option('woofirstpurchase_email_main_heading_text_setting', __('Enjoy a $25 Discount','woocommerce-first-purchase'))).'<br><br>'.esc_html(get_option('woofirstpurchase_email_middle_line_text_setting', __('Here\'s an exclusive coupon to help you with your first purchase: {couponcode}','woocommerce-first-purchase'))).'<br><br>'.esc_html(get_option('woofirstpurchase_email_bottom_line_text_setting', __('Thank you for shopping with us.','woocommerce-first-purchase')));
			$email_message = str_replace("{couponcode}", $couponcode, $email_message);
		}

		

		// Filter the mail content type.
		function woofirstpurchase_set_mail_content_type() {
		    return 'text/html';
		}
		add_filter( 'wp_mail_content_type', 'woofirstpurchase_set_mail_content_type' );

		wp_mail($sanitized_email, $email_subject, $email_message, $headers);
		
		remove_filter( 'wp_mail_content_type', 'woofirstpurchase_set_mail_content_type' );
		 
	}