12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- // include it
- use PHPMailer\PHPMailer\PHPMailer;
- use PHPMailer\PHPMailer\Exception;
- require_once('../include/phpmailer6/PHPMailer.php');
- require_once('../include/phpmailer6/SMTP.php');
- require_once('../include/phpmailer6/Exception.php');
- include_once('../include/xTemplate/xtemplate.class.php'); // including mpdf.php
- if(!isset($_GET["correo"])){
- echo "Debes especificar la dirección a la que se enviará el correo <strong>?correo=</strong>";
- exit();
- }
- $xtpl = new XTemplate('../tpl/nombramiento.tpl.html');
- $xtpl->parse("main");
- $correo = $_GET["correo"];
- $msgInfo = $xtpl->text("main");
- //$msgInfo = "<h1>Esto es una prueba</h1><p>El correo se envió atutomáticamente, no debes hacer nada más.</p>";
- $mail = new PHPMailer(true);
-
- $mail->IsSMTP();
- $mail->SMTPAuth = true;
-
- $mail->Host = "smtp.office365.com";
- $mail->Port = 587; // or 587
- $mail->SMTPSecure = 'tls'; // if Port is 587
- $mail->Username = "alejandro.lara@lasallistas.org.mx";
- $mail->Password = "";
-
- // Typical mail data
-
- $mail->AddAddress($correo);
- $mail->SetFrom("alejandro.lara@lasallistas.org.mx", "Yo");
- $mail->Subject = "Add Your Subject";
- $mail->Body = "This is the HTML message body For <b>Setting up PHPMailer with Office365 SMTP using php</b>";
- $mail->AltBody = "This is the with out HTML message For Setting up PHPMailer with Office365 using SMTP";
-
- try
- {
- $mail->Send();
- echo "Setting up PHPMailer with Office365 SMTP using php Success!";
- }
- catch(Exception $exception)
- {
- echo "<pre>";
- var_dump($exception);
- echo "</pre>";
- //Something went bad
- echo "PHPMailer with Office365 Fail :: " . $mail->ErrorInfo;
- }
- ?>
|