Skip to content

Commit

Permalink
add mail service
Browse files Browse the repository at this point in the history
  • Loading branch information
bhamidou committed Oct 13, 2023
1 parent bf9c3f3 commit 496e204
Show file tree
Hide file tree
Showing 83 changed files with 11,424 additions and 73 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Constantes.php
Constantes.php
.vscode/*
.vscode/settings.json
18 changes: 0 additions & 18 deletions .vscode/settings.json

This file was deleted.

9 changes: 0 additions & 9 deletions Constantes.php

This file was deleted.

54 changes: 54 additions & 0 deletions Controller/Mail/Mail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
//https://www.espai.es/blog/2022/06/phpmailer-ya-no-envia-correos-a-traves-de-gmail/
//https://codigosdeprogramacion.com/2022/04/05/enviar-correo-electronico-con-phpmailer/

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;

require_once 'phpmailer/src/Exception.php';
require_once 'phpmailer/src/PHPMailer.php';
require_once 'phpmailer/src/SMTP.php';

class Mail {
public function sendmail($destinomail, $destinonombre, $asunto, $newPass)
{

try {
$mail = new PHPMailer();
//Configuración del servidor
//$mail->SMTPDebug = SMTP::DEBUG_SERVER; //Habilitar los mensajes de depuración
$mail->isSMTP(); //Enviar usando SMTP
$mail->Host = 'smtp.zoho.eu'; //Configurar el servidor SMTP
$mail->SMTPAuth = true; //Habilitar autenticación SMTP
$mail->Username = Constantes::$MAILUsername; //Nombre de usuario SMTP
$mail->Password = Constantes::$MAILPass; //Contraseña SMTP
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Habilitar el cifrado TLS
$mail->Port = 465; //Puerto TCP al que conectarse; use 587 si configuró `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`

//Emisor
$mail->setFrom(Constantes::$MAILUsername, Constantes::$MAILFromName);

//Destinatarios
$mail->addAddress($destinomail, $destinonombre); //Añadir un destinatario, el nombre es opcional

//Destinatarios opcionales
// $mail->addReplyTo('[email protected]', 'Information'); //Responder a
// $mail->addCC('[email protected]'); //Copia pública
// $mail->addBCC('[email protected]'); //Copia oculta

//Archivos adjuntos
// $mail->addAttachment('files/comunicado.pdf', 'Comunicado'); //Agregar archivos adjuntos, nombre opcional

//Nombre opcional
$mail->isHTML(true); //Establecer el formato de correo electrónico en HTMl
$mail->Subject = $asunto;
$mail->Body = `<meta charset="ISO-8859-1"> ¡Su nueva contraseña es: <b>$newPass</b>`;
$mail->AltBody = 'Desde Gitignore Tech esperemos que disfrute de su cuenta';

$mail->send(); //Enviar correo eletrónico

} catch (Exception $e) {

}
}
}
46 changes: 46 additions & 0 deletions Controller/Mail/phpmailer/COMMITMENT
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
GPL Cooperation Commitment
Version 1.0

Before filing or continuing to prosecute any legal proceeding or claim
(other than a Defensive Action) arising from termination of a Covered
License, we commit to extend to the person or entity ('you') accused
of violating the Covered License the following provisions regarding
cure and reinstatement, taken from GPL version 3. As used here, the
term 'this License' refers to the specific Covered License being
enforced.

However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly
and finally terminates your license, and (b) permanently, if the
copyright holder fails to notify you of the violation by some
reasonable means prior to 60 days after the cessation.

Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you
have received notice of violation of this License (for any work)
from that copyright holder, and you cure the violation prior to 30
days after your receipt of the notice.

We intend this Commitment to be irrevocable, and binding and
enforceable against us and assignees of or successors to our
copyrights.

Definitions

'Covered License' means the GNU General Public License, version 2
(GPLv2), the GNU Lesser General Public License, version 2.1
(LGPLv2.1), or the GNU Library General Public License, version 2
(LGPLv2), all as published by the Free Software Foundation.

'Defensive Action' means a legal proceeding or claim that We bring
against you in response to a prior proceeding or claim initiated by
you or your affiliate.

'We' means each contributor to this repository as of the date of
inclusion of this file, including subsidiaries of a corporate
contributor.

This work is available under a Creative Commons Attribution-ShareAlike
4.0 International license (https://creativecommons.org/licenses/by-sa/4.0/).
Loading

0 comments on commit 496e204

Please sign in to comment.