mail.php
2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\SMTP;
require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
function enviarMail($id, $email, $dia, $hora, $nombre) {
$id = ($id*50)*20;
$mail = new PHPMailer(true);
//Server settings
$mail->SMTPDebug = SMTP::DEBUG_SERVER; // Enable verbose debug output
$mail->isSMTP(); // Send using SMTP
$mail->Host = 'smtp.gmail.com'; // Set the SMTP server to send through
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'turnos.gobierno@gmail.com'; // SMTP username
$mail->Password = 'nvidia123'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
$mail->Port = 587; // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
//Recipients
$mail->setFrom('turnos.gobierno@gmail.com', 'Gobierno de Catamarca - Turnos Online');
$mail->addAddress($email); // Add a recipient
// Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Confirme su turno';
$mail->Body = '<img src="https://dgrpi.arca.gob.ar/turnos/img/logomail.png"><br>
<h5>
<ul>
<li>Nombre: '.$nombre.'</li>
<li>Día: '.$dia.'</li>
<li>Hora: '.$hora.'</li>
</ul>
</h5>
<h5>Para confirmar su turno haga clic en el siguiente enlace</h5><br>
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td>
<table cellspacing="0" cellpadding="0">
<tr>
<td style="border-radius: 2px;" bgcolor="#214370">
<a href="http://localhost/turnosapp/confirmar.php?code='.base64_encode($id).'" target="_blank" style="padding: 8px 12px; border: 1px solid #214370;border-radius: 2px;font-family: Helvetica, Arial, sans-serif;font-size: 14px; color: #ffffff;text-decoration: none;font-weight:bold;display: inline-block;">
Confirmar turno
</a>
</td>
</tr>
</table>
</td>
</tr>
</table>';
//$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
}
?>