<?php
$cuerpo = "Nombre: " . $nombre . "<br>Whatsapp: " . $whatsapp . "<br>Ciudad: " . $ciudad . "<br>Email: " . $email . "<br>Curso: " . $curso . "<br>Mensaje: " . $mensaje;
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
//Archivos se consiguen descargando desde git PHPMailer
require 'phpmailer/Exception.php';
require 'phpmailer/PHPMailer.php';
require 'phpmailer/SMTP.php';
$mail = new PHPMailer(true); // Passing `true` enables exceptions
//Server settings
$mail->SMTPDebug = 0; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'host.mail'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'mail'; // SMTP username
$mail->Password = 'password'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
//Recipients
$mail->setFrom($email, $nombre);
$mail->addAddress('mailalquellegara', 'nombre'); // Add a recipient
//Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'asunto';
$mail->Body = $cuerpo;
$mail->CharSet = 'utf-8';
$mail->send();