-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from leowebc/master
LLibrary OK
- Loading branch information
Showing
2 changed files
with
13 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 ); | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |