mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
refactor from email names to use config() values
This commit is contained in:
parent
b63972e250
commit
aa852930e6
@ -77,6 +77,8 @@ class BaseMailerJob implements ShouldQueue
|
||||
|
||||
Config::set('mail.driver', 'gmail');
|
||||
Config::set('services.gmail.token', $user->oauth_user_token->access_token);
|
||||
Config::set('mail.from.address', $user->email);
|
||||
Config::set('mail.from.name', $user->present()->name());
|
||||
|
||||
(new MailServiceProvider(app()))->register();
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ class EntityPaidMailer extends BaseMailerJob implements ShouldQueue
|
||||
|
||||
try {
|
||||
$mail_obj = (new EntityPaidObject($this->payment))->build();
|
||||
$mail_obj->from = [$this->user->email, $this->user->present()->name()];
|
||||
$mail_obj->from = [config('mail.from.address'), config('mail.from.name')];
|
||||
|
||||
//send email
|
||||
Mail::to($this->user->email)
|
||||
|
@ -81,7 +81,7 @@ class EntitySentMailer extends BaseMailerJob implements ShouldQueue
|
||||
$this->setMailDriver();
|
||||
|
||||
$mail_obj = (new EntitySentObject($this->invitation, $this->entity_type))->build();
|
||||
$mail_obj->from = [$this->entity->user->email, $this->entity->user->present()->name()];
|
||||
$mail_obj->from = [config('mail.from.address'), config('mail.from.name')];
|
||||
|
||||
try {
|
||||
Mail::to($this->user->email)
|
||||
|
@ -81,7 +81,7 @@ class EntityViewedMailer extends BaseMailerJob implements ShouldQueue
|
||||
$this->setMailDriver();
|
||||
|
||||
$mail_obj = (new EntityViewedObject($this->invitation, $this->entity_type))->build();
|
||||
$mail_obj->from = [$this->entity->user->email, $this->entity->user->present()->name()];
|
||||
$mail_obj->from = [config('mail.from.address'), config('mail.from.name')];
|
||||
|
||||
//send email
|
||||
try {
|
||||
|
@ -91,7 +91,7 @@ class PaymentFailureMailer extends BaseMailerJob implements ShouldQueue
|
||||
unset($methods[$key]);
|
||||
|
||||
$mail_obj = (new PaymentFailureObject($this->client, $this->message, $this->amount, $this->company))->build();
|
||||
$mail_obj->from = [$this->company->owner()->email, $this->company->owner()->present()->name()];
|
||||
$mail_obj->from = [config('mail.from.address'), config('mail.from.name')];
|
||||
|
||||
//send email
|
||||
try {
|
||||
|
@ -199,8 +199,9 @@ class Import implements ShouldQueue
|
||||
}
|
||||
|
||||
$this->setInitialCompanyLedgerBalances();
|
||||
|
||||
Mail::to($this->user)->send(new MigrationCompleted());
|
||||
|
||||
Mail::to($this->user)
|
||||
->send(new MigrationCompleted());
|
||||
|
||||
/*After a migration first some basic jobs to ensure the system is up to date*/
|
||||
VersionCheck::dispatch();
|
||||
|
@ -34,7 +34,7 @@ class EntityNotificationMailer extends Mailable
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->from($this->mail_obj->from[0], $this->mail_obj->from[1])
|
||||
return $this->from(config('mail.from.address'), config('mail.from.name'))
|
||||
->subject($this->mail_obj->subject)
|
||||
->markdown($this->mail_obj->markdown, $this->mail_obj->data)
|
||||
->withSwiftMessage(function ($message) {
|
||||
|
@ -43,9 +43,9 @@ class BouncedEmail extends Mailable implements ShouldQueue
|
||||
$entity_type = class_basename(lcfirst($this->invitation->getEntityType()));
|
||||
|
||||
$subject = ctrans("texts.notification_{$entity_type}_bounced_subject", ['invoice' => $invoice->number]);
|
||||
|
||||
|
||||
return
|
||||
$this->from($invitation->user->email)
|
||||
$this->from(config('mail.from.name'), config('mail.from.address'))
|
||||
->text()
|
||||
->subject($subject);
|
||||
|
||||
|
@ -30,13 +30,15 @@ class DownloadInvoices extends Mailable
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->subject(ctrans('texts.download_files'))
|
||||
->markdown(
|
||||
'email.admin.download_files',
|
||||
[
|
||||
'url' => $this->file_path,
|
||||
'logo' => $this->company->present()->logo,
|
||||
]
|
||||
);
|
||||
|
||||
return $this->from(config('mail.from.name'), config('mail.from.address'))
|
||||
->subject(ctrans('texts.download_files'))
|
||||
->markdown(
|
||||
'email.admin.download_files',
|
||||
[
|
||||
'url' => $this->file_path,
|
||||
'logo' => $this->company->present()->logo,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ class ExistingMigration extends Mailable
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->view('email.migration.existing');
|
||||
|
||||
return $this->from(config('mail.from.name'), config('mail.from.address'))
|
||||
->view('email.migration.existing');
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ class InvoiceWasPaid extends Mailable
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->view('email.invoices.paid');
|
||||
return $this->from(config('mail.from.address'), config('mail.from.name'))->view('email.invoices.paid');
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,8 @@ class MigrationCompleted extends Mailable
|
||||
public function build()
|
||||
{
|
||||
$data['settings'] = auth()->user()->company()->settings;
|
||||
|
||||
return $this->view('email.migration.completed', $data);
|
||||
|
||||
return $this->from(config('mail.from.name'), config('mail.from.address'))
|
||||
->view('email.migration.completed', $data);
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,8 @@ class MigrationFailed extends Mailable
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->from('noreply@invoiceninja.com')
|
||||
->view('email.migration.failed');
|
||||
|
||||
return $this->from(config('mail.from.name'), config('mail.from.address'))
|
||||
->view('email.migration.failed');
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ class QuoteWasApproved extends Mailable
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->view('email.quotes.approved');
|
||||
return $this->from(config('mail.from.address'), config('mail.from.name'))->view('email.quotes.approved');
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class SupportMessageSent extends Mailable
|
||||
|
||||
$subject = "Customer MSG {$user->present()->name} - [{$plan} - DB:{$company->db}]";
|
||||
|
||||
return $this->from(config('mail.from.address')) //todo this needs to be fixed to handle the hosted version
|
||||
return $this->from(config('mail.from.address'), config('mail.from.name')) //todo this needs to be fixed to handle the hosted version
|
||||
->subject($subject)
|
||||
->markdown('email.support.message', [
|
||||
'message' => $this->message,
|
||||
|
@ -52,7 +52,7 @@ class TemplateEmail extends Mailable
|
||||
|
||||
$company = $this->client->company;
|
||||
|
||||
$this->from($this->user->email, $this->user->present()->name());
|
||||
$this->from(config('mail.from.address'), config('mail.from.name'));
|
||||
|
||||
if (strlen($settings->reply_to_email) > 1) {
|
||||
$this->replyTo($settings->reply_to_email, $settings->reply_to_email);
|
||||
|
@ -36,7 +36,7 @@ class TestMailServer extends Mailable
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->from($this->from_email) //todo this needs to be fixed to handle the hosted version
|
||||
return $this->from(config('mail.from.address'), config('mail.from.name'))
|
||||
->subject(ctrans('texts.email'))
|
||||
->markdown('email.support.message', [
|
||||
'message' => $this->message,
|
||||
|
@ -34,7 +34,7 @@ class UserNotificationMailer extends Mailable
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->from($this->mail_obj->from[0], $this->mail_obj->from[1]) //todo
|
||||
return $this->from(config('mail.from.address'), config('mail.from.name'))
|
||||
->subject($this->mail_obj->subject)
|
||||
->markdown($this->mail_obj->markdown, $this->mail_obj->data)
|
||||
->withSwiftMessage(function ($message) {
|
||||
|
@ -23,6 +23,7 @@ return [
|
||||
'date_time_format' => 'Y-m-d H:i',
|
||||
'daily_email_limit' => 300,
|
||||
'error_email' => env('ERROR_EMAIL', ''),
|
||||
'mailer' => env('MAIL_MAILER',''),
|
||||
'company_id' => 0,
|
||||
'hash_salt' => env('HASH_SALT', ''),
|
||||
'currency_converter_api_key' => env('OPENEXCHANGE_APP_ID', ''),
|
||||
|
Loading…
x
Reference in New Issue
Block a user