Skip to content

Commit

Permalink
Merge pull request #3 from leowebc/master
Browse files Browse the repository at this point in the history
LLibrary OK
  • Loading branch information
leowebc authored Jan 22, 2024
2 parents a09cb77 + 00c5eee commit 80964a0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
21 changes: 11 additions & 10 deletions _app/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@ class Email
{
private $email = \stdClass::class;

public function __construct()
public function __construct($smtpDebug, $host, $user, $pass, $smtpSecure, $port, $setFronEmail, $setDromName)
{

$this->mail =new PHPMailer(true);

$this->mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
$this->mail->isSMTP(); //Send using SMTP
$this->mail->Host = 'smtp.example.com'; //Set the SMTP server to send through
$this->mail->SMTPAuth = true; //Enable SMTP authentication
$this->mail->Username = 'user@example.com'; //SMTP username
$this->mail->Password = 'secret'; //SMTP password
$this->mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
$this->mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
$this->mail->SMTPDebug = $smtpDebug; //Enable verbose debug output
$this->mail->isSMTP(); //Send using SMTP
$this->mail->Host = $host; //Set the SMTP server to send through
$this->mail->SMTPAuth = true; //Enable SMTP authentication
$this->mail->Username = $user; //SMTP username
$this->mail->Password = $pass; //SMTP password
$this->mail->SMTPSecure = $smtpSecure; //Enable implicit TLS encryption
$this->mail->Port = $port; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
$this->mail->CharSet = 'utf8';
$this->mail->isHTML( true);
$this->mail->setFrom('[email protected]', 'Equipe Gustavoweb' );
$this->mail->setFrom($setFronEmail, $setDromName );

}

Expand Down
4 changes: 2 additions & 2 deletions index.php → test/index.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

require __DIR__ . "/lib_ext/autoload.php";
require __DIR__ . "/../lib_ext/autoload.php";


use Notification\Email;


$novoEmail = new \Notification\Email();
$novoEmail = new Email(2, "mail.gustavo.me", "[email protected]", "teste@123", "tls", 587 , "[email protected]", "Equipe Leonardo" );
$novoEmail->sendMail("Assunto de teste", "<p>Esse ´um e-mail <b> teste</b>!</p>", "[email protected]", "Gustavo Web", "[email protected]", "Leonardo");

var_dump($novoEmail);

0 comments on commit 80964a0

Please sign in to comment.