2019-05-29 06:33:53 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2019-05-29 06:33:53 +02:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2021-01-03 22:54:54 +01:00
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-05-29 06:33:53 +02:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Mail;
|
|
|
|
|
|
|
|
use App\Models\User;
|
|
|
|
use Illuminate\Bus\Queueable;
|
2020-09-06 11:38:10 +02:00
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
2019-05-29 06:33:53 +02:00
|
|
|
use Illuminate\Mail\Mailable;
|
|
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
|
|
|
|
class BouncedEmail extends Mailable implements ShouldQueue
|
|
|
|
{
|
|
|
|
use Queueable, SerializesModels;
|
|
|
|
|
|
|
|
public $invitation;
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2019-05-29 06:33:53 +02:00
|
|
|
/**
|
|
|
|
* Create a new message instance.
|
|
|
|
*
|
2020-10-28 11:10:49 +01:00
|
|
|
* @param $invitation
|
2019-05-29 06:33:53 +02:00
|
|
|
*/
|
|
|
|
public function __construct($invitation)
|
|
|
|
{
|
|
|
|
$this->invitation = $invitation;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Build the message.
|
|
|
|
*
|
|
|
|
* @return $this
|
|
|
|
*/
|
|
|
|
public function build()
|
|
|
|
{
|
|
|
|
$entity_type = class_basename(lcfirst($this->invitation->getEntityType()));
|
|
|
|
|
2019-11-27 11:27:24 +01:00
|
|
|
$subject = ctrans("texts.notification_{$entity_type}_bounced_subject", ['invoice' => $invoice->number]);
|
2020-12-02 04:08:35 +01:00
|
|
|
|
2019-05-29 06:33:53 +02:00
|
|
|
return
|
2020-12-03 12:00:34 +01:00
|
|
|
$this->from(config('mail.from.address'), config('mail.from.name'))
|
2019-05-29 06:33:53 +02:00
|
|
|
->text()
|
|
|
|
->subject($subject);
|
|
|
|
|
2019-12-30 22:59:12 +01:00
|
|
|
//todo
|
2019-05-29 06:33:53 +02:00
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
|
//todo determine WHO is notified!! In this instance the _user_ is notified
|
|
|
|
|
|
|
|
Mail::to($invitation->user->email)
|
|
|
|
//->cc('')
|
|
|
|
//->bcc('')
|
|
|
|
->queue(new BouncedEmail($invitation));
|
2019-12-30 22:59:12 +01:00
|
|
|
|
2020-07-29 04:13:12 +02:00
|
|
|
return $this->from('x@gmail.com') //todo
|
2019-05-29 06:33:53 +02:00
|
|
|
->subject(ctrans('texts.confirmation_subject'))
|
|
|
|
->markdown('email.auth.verify', ['user' => $this->user])
|
|
|
|
->text('email.auth.verify_text');
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|