Common functionalities
This commit is contained in:
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
namespace App\Common\Email;
|
||||
|
||||
use \App\Core\Template\Output as Output;
|
||||
use \App\Core\Email\Classes\Email as Email;
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\SMTP;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
class EmailController extends \DefaultController
|
||||
{
|
||||
|
||||
protected $_class = Email::class;
|
||||
protected $_baseUrl = '/email';
|
||||
|
||||
/**
|
||||
* Index
|
||||
* Show the main Email list
|
||||
*/
|
||||
function index()
|
||||
{
|
||||
Output::render('index');
|
||||
/*
|
||||
$mail = new PHPMailer(true);
|
||||
|
||||
// Server settings
|
||||
$mail->SMTPDebug = SMTP::DEBUG_SERVER; // for detailed debug output
|
||||
$mail->isSMTP();
|
||||
$mail->Host = 'smtp.gmail.com';
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
|
||||
$mail->Port = 587;
|
||||
|
||||
$mail->Username = 'ahwelp@universo.univates.br';
|
||||
$mail->Password = '********';
|
||||
|
||||
// Sender and recipient settings
|
||||
$mail->setFrom('ahwelp@universo.univates.br', 'Sender Name');
|
||||
$mail->addAddress('ahwelp@univates.br', 'Receiver Name');
|
||||
$mail->addReplyTo('ahwelp@universo.univates.br', 'Sender Name');
|
||||
|
||||
// Setting the email content
|
||||
$mail->IsHTML(true);
|
||||
$mail->Subject = "Send email using Gmail SMTP and PHPMailer";
|
||||
$mail->Body = 'HTML message body. <b>Gmail</b> SMTP email body.';
|
||||
$mail->AltBody = 'Plain text message body for non-HTML email client. Gmail SMTP email body.';
|
||||
|
||||
$mail->send();
|
||||
echo "Email message sent.";*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Create
|
||||
*
|
||||
* Render the main Email formulary
|
||||
*/
|
||||
function create()
|
||||
{
|
||||
Output::render('form', ['id' => 0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store
|
||||
*
|
||||
* Store the param on the database
|
||||
* @param Email $email
|
||||
*/
|
||||
function store(Email $email)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Search
|
||||
*
|
||||
* Store the param on the database
|
||||
* @param Email $email
|
||||
*/
|
||||
function search()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Show
|
||||
*
|
||||
* Render one register
|
||||
*
|
||||
* @param Email $email
|
||||
*/
|
||||
function show(Email $email)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit
|
||||
*
|
||||
* Render the formular for a database Email
|
||||
*
|
||||
* @param Email $email
|
||||
*/
|
||||
function edit(Email $email)
|
||||
{
|
||||
Output::render('form', $email);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update
|
||||
* Store the changes of the param on the database
|
||||
*
|
||||
* @param Email $email
|
||||
*/
|
||||
function update(Email $email)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy
|
||||
* If the object has soft delete.
|
||||
*
|
||||
* @param Email $email
|
||||
*/
|
||||
function destroy(Email $email)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge
|
||||
* Remove object even with soft delete.
|
||||
*
|
||||
* @param Email $email
|
||||
*/
|
||||
function purge(Email $email)
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user