Send invoices by email.
This commit is contained in:
32
app/TenantMail.php
Normal file
32
app/TenantMail.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use App\Http\Option;
|
||||
use Illuminate\Mail\Mailer;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class TenantMail
|
||||
{
|
||||
/**
|
||||
* Build a tenant-mailer from options
|
||||
*
|
||||
* @return Mailer
|
||||
*/
|
||||
public static function get(): Mailer
|
||||
{
|
||||
$options = Option::optionsAsObject();
|
||||
$mailer = Mail::build([
|
||||
'transport' => $options->mail_transport,
|
||||
'host' => $options->mail_host,
|
||||
'port' => $options->mail_port,
|
||||
'encryption' => (property_exists($options, 'mail_encryption')) ? $options->mail_encryption : null,
|
||||
'username' => (property_exists($options, 'mail_encryption')) ? $options->mail_username : null,
|
||||
'password' => (property_exists($options, 'mail_encryption')) ? $options->mail_password : null,
|
||||
]);
|
||||
|
||||
$mailer->alwaysFrom($options->email, $options->representative);
|
||||
|
||||
return $mailer;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user