Fix procedura invio email

This commit is contained in:
Dasc3er 2021-08-05 11:18:54 +02:00
parent ab27243f13
commit 4691573a28
2 changed files with 7 additions and 17 deletions

View File

@ -27,7 +27,7 @@ use Notifications\EmailNotification;
class SegnalazioneBug extends Resource implements RetrieveInterface, CreateInterface class SegnalazioneBug extends Resource implements RetrieveInterface, CreateInterface
{ {
protected static $bug_email = 'info@openstamanager.com'; protected static $bug_email = 'thomaszilio77@gmail.com';
public function retrieve($request) public function retrieve($request)
{ {
@ -44,27 +44,18 @@ class SegnalazioneBug extends Resource implements RetrieveInterface, CreateInter
public function create($request) public function create($request)
{ {
$data = $request['data'];
$account = Account::where('predefined', true)->first(); $account = Account::where('predefined', true)->first();
// Preparazione email // Preparazione email
$mail = new EmailNotification($account); $mail = new EmailNotification($account, true);
// Destinatario // Destinatario
$mail->AddAddress(self::$bug_email); $mail->AddAddress(self::$bug_email);
// Oggetto // Oggetto e contenuto
$mail->subject = 'Segnalazione bug App OSM '.$request['version']; $mail->Subject = 'Segnalazione bug App OSM '.$data['version'];
$mail->Body = $data['body'];
$infos = [
];
$body = '';
foreach ($infos as $key => $value) {
$body .= '<p>'.$key.': '.$value.'</p>';
}
// Contenuti
$mail->content = $body;
// Tentativo di invio diretto // Tentativo di invio diretto
$email_success = $mail->send(); $email_success = $mail->send();

View File

@ -37,7 +37,7 @@ class EmailNotification extends PHPMailer implements NotificationInterface
public function __construct($account = null, $exceptions = null) public function __construct($account = null, $exceptions = null)
{ {
parent::__construct(true); parent::__construct($exceptions);
$this->CharSet = 'UTF-8'; $this->CharSet = 'UTF-8';
@ -215,7 +215,6 @@ class EmailNotification extends PHPMailer implements NotificationInterface
// Segnalazione degli errori // Segnalazione degli errori
if (!$result) { if (!$result) {
$logger = logger(); $logger = logger();
dd($this->infos);
foreach ($this->infos as $info) { foreach ($this->infos as $info) {
$logger->addRecord(\Monolog\Logger::ERROR, $info); $logger->addRecord(\Monolog\Logger::ERROR, $info);
} }