<?php

$nome = "Davide";
$cognome = "Bianchi";

require '../includes/Exception.php';
require '../includes/PHPMailer.php';
require '../includes/SMTP.php';

$timestamp = time();

$mailHtml = '<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1"  />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<style type="text/css">
/* CLIENT-SPECIFIC STYLES */

/* Prevent WebKit and Windows mobile changing default text sizes */
body, table, td, a {
	-webkit-text-size-adjust: 100%;
	-ms-text-size-adjust: 100%;
}
	
/* Remove spacing between tables in Outlook 2007 and up */
table, td {
	mso-table-lspace: 0pt;
	mso-table-rspace: 0pt;
}
	
/* Allow smoother rendering of resized image in Internet Explorer */
img {
	-ms-interpolation-mode: bicubic;
}

/* RESET STYLES */
body {
	height: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	width: 100% !important;
}

img {
	border: 0;
	height: auto;
	line-height: 100%;
	outline: none;
	text-decoration: none;
}

table {
	border-collapse: collapse !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;
}

/* MOBILE STYLES */
@media screen and (max-width:625px) {

/* ALLOWS FOR FLUID TABLES */	
.wrapper {
	width: 100% !important;
	max-width: 100% !important;
}
	
/* ADJUSTS LAYOUT OF LOGO IMAGE */
.logo img {
	margin: 0 auto !important;
}
	
/* USE THESE CLASSES TO HIDE CONTENT ON MOBILE */
.mobile-hide {
	display: none !important;
}

.img-max {
	max-width: 100% !important;
	width: 100% !important;
	height: auto !important;
}

.gf {
	max-width: 260px !important;
	width: 100% !important;
	height: auto !important;
}	
	
/* FULL-WIDTH TABLES */
.responsive-table {
	width: 100% !important;
}

/* UTILITY CLASSES FOR ADJUSTING PADDING ON MOBILE */
.padding {
	padding: 10px 5% 10px 5%;
}

.padding-copy {
	padding-left: 5% !important;
	padding-right: 5% !important;
	text-align: center !important;
	font-size: 16px !important;
	line-height: 21px !important;
}	
	
.padding-header {
	padding: 20px 5% 0 5% !important;
	text-align: center;
	font-size: 35px !important;
}
	
.padding-hero {
	padding: 20px 0 0 0 !important;
	text-align: center;
}
	
.section-padding {
	padding: 0 15px 0 15px !important;
}

/* ADJUST BUTTONS ON MOBILE */
.mobile-button-container {
	margin: 0 auto;
	width: 100% !important;
}

.mobile-button {
	width: 90% !important;
	font-size: 22px !important;
	display: block !important;
}
}
</style>
</head>
<body style="margin: 0 !important; padding: 0 !important;" bgcolor="#eeeeee">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td bgcolor="#eeeeee" align="center" style="padding:15px 15px 15px 15px;" class="section-padding">
            <!--[if (gte mso 9)|(IE)]>
            <table align="center" border="0" cellspacing="0" cellpadding="0" width="600">
            <tr>
            <td align="center" valign="top" width="600">
            <![endif]-->
			<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 600px;" class="wrapper">
				<tr>
					<td bgcolor="#ce020f" style="border: solid #ffffff; border-width: 5px 5px 5px 5px;">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td>
									<table width="100%" border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td align="center" style="padding: 20px 75px 20px 75px; font-size: 40px; font-family: Arial, sans-serif; color: #ffffff;" class="padding-header"><strong>Conferma il tuo indirizzo email !</strong></td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
							</tr>
							<tr>
								<td>
									<table width="100%" align="center" border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td align="left" style="padding: 0px 50px 0 50px; font-size: 16px; line-height: 20px; font-family: Arial, sans-serif; color: #ffffff;" class="padding-copy"><strong>Ciao ' . $nome . ',</strong><br>
											</td>
										</tr>
										<tr>
											<td align="left" style="padding: 20px 50px 0 50px; font-size: 14px; line-height: 22px; font-family: Arial, sans-serif; color: #ffffff;" class="padding-copy"> per confermare la tua partecipazione è necessario confermare il tuo indirizzo email!<br>
											    <br><br>
											</td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td align="center">
									<table width="100%" align="center" border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td align="center" style="padding:2px 15px 35px 15px" class="padding">
												<table border="0" cellspacing="0" cellpadding="0" class="mobile-button-container">
													<tr>
														<td align="center" style="border-radius: 0px;">
														<div><!--[if mso]>
  <v:rect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="[LINK]&utm_source=224&utm_medium=email&utm_campaign=224-email-C1&utm_content=BUTTON" style="height:70px;v-text-anchor:middle;width:400px;" strokecolor="#ffffff" fillcolor="#228aff">
    <w:anchorlock/>
    <center style="color:#ffffff;font-family:sans-serif;font-size:35px;font-weight:bold;">La tua chance!</center>
  </v:rect>
<![endif]--><a href="https://www.concorso-per-te.com/conferma_mail.php?salt=' . $timestamp . '"
style="background-color:#228aff;border:2px solid #ffffff;color:#ffffff;display:inline-block;font-family:sans-serif;font-size:35px;font-weight:bold;line-height:70px;text-align:center;text-decoration:none;width:400px;-webkit-text-size-adjust:none;mso-hide:all;" class="mobile-button">Clicca qui!</a></div>	
														</td>
													</tr>
												</table>
											</td>
										</tr>
									</table>
								</td>
							</tr>							
						</table>
					</td>
				</tr>
				<tr>
				</tr>				
			</table>
            <!--[if (gte mso 9)|(IE)]>
            </td>
            </tr>
            </table>
            <![endif]-->			
		</td>
	</tr>
</table>

</body>
</html>';

$altMail = 'Solo testo';

/* $headers = 'From: Concorso Per Te <concorsi@concorso-per-te.com>' . "\r\n" .
    'Reply-To: concorsi@concorso-per-te.com' . "\r\n" . 
	'Content-type: text/html; charset:UTF-8'. "\r\n" . 
    'X-Mailer: PHP/' . phpversion();

mail($email,"Conferma il tuo indirizzo email","Ciao $nome, per confermare la tua partecipazione è necessario confermare il tuo indirizzo email! <a href=\"conferma_mail.php?salt=$timestamp\">Clicca su questo link</a> per la conferma",$headers);

*/

// invio con PHP MAILER 
$email = "brolyweb@gmail.com";

$mail = new PHPMailer\PHPMailer\PHPMailer(true);

$mail->isSMTP();
$mail->Host       = 'mail.concorso-per-te.com';                    // Set the SMTP server to send through
$mail->SMTPAuth   = true;                                   // Enable SMTP authentication
$mail->Username   = 'concorsi@concorso-per-te.com';                     // SMTP username
$mail->Password   = 'pWMLileJyTUC';                               // SMTP password
$mail->SMTPSecure = PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_STARTTLS;         // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` also accepted
$mail->Port       = 587;                                    // TCP port to connect to

$mail->setFrom('concorsi@concorso-per-te.com','Concorso per te');
$mail->addReplyTo('concorsi@concorso-per-te.com','Concorso per te');
$mail->addAddress($email,"$nome $cognome");
$mail->isHTML(true);
$mail->Subject = "$nome, conferma la tua partecipazione";
$mail->Body = $mailHtml;
$mail->altBody = $altMail;

$mail->send();
?>