mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Add send test email checks
This commit is contained in:
parent
e7a1f8ef74
commit
43f904bdbe
@ -11,16 +11,18 @@
|
|||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App\DataMapper\CompanySettings;
|
use Faker\Factory;
|
||||||
use App\DataMapper\DefaultSettings;
|
use App\Models\User;
|
||||||
use App\Jobs\Mail\NinjaMailerJob;
|
|
||||||
use App\Jobs\Mail\NinjaMailerObject;
|
|
||||||
use App\Mail\Migration\MaxCompanies;
|
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\User;
|
use App\Mail\TestMailServer;
|
||||||
use Faker\Factory;
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
use App\Jobs\Mail\NinjaMailerJob;
|
||||||
|
use App\DataMapper\CompanySettings;
|
||||||
|
use App\DataMapper\DefaultSettings;
|
||||||
|
use App\Jobs\Mail\NinjaMailerObject;
|
||||||
|
use App\Mail\Migration\MaxCompanies;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
|
||||||
class SendTestEmails extends Command
|
class SendTestEmails extends Command
|
||||||
{
|
{
|
||||||
@ -55,39 +57,26 @@ class SendTestEmails extends Command
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$faker = Factory::create();
|
|
||||||
|
|
||||||
$account = Account::factory()->create();
|
$to_user = User::first();
|
||||||
|
|
||||||
$user = User::factory()->create([
|
|
||||||
'account_id' => $account->id,
|
|
||||||
'confirmation_code' => '123',
|
|
||||||
'email' => $faker->safeEmail(),
|
|
||||||
'first_name' => 'John',
|
|
||||||
'last_name' => 'Doe',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$company = Company::factory()->create([
|
|
||||||
'account_id' => $account->id,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$user->companies()->attach($company->id, [
|
|
||||||
'account_id' => $account->id,
|
|
||||||
'is_owner' => 1,
|
|
||||||
'is_admin' => 1,
|
|
||||||
'is_locked' => 0,
|
|
||||||
'permissions' => '',
|
|
||||||
'notifications' => CompanySettings::notificationDefaults(),
|
|
||||||
//'settings' => DefaultSettings::userSettings(),
|
|
||||||
'settings' => null,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$nmo = new NinjaMailerObject;
|
$nmo = new NinjaMailerObject;
|
||||||
$nmo->mailable = new MaxCompanies($user->account->companies()->first());
|
$nmo->mailable = new TestMailServer('Email Server Works!', config('mail.from.address'));
|
||||||
$nmo->company = $user->account->companies()->first();
|
$nmo->company = $to_user->account->companies()->first();
|
||||||
$nmo->settings = $user->account->companies()->first()->settings;
|
$nmo->settings = $to_user->account->companies()->first()->settings;
|
||||||
$nmo->to_user = $user;
|
$nmo->to_user = $to_user;
|
||||||
|
|
||||||
(new NinjaMailerJob($nmo))->handle();
|
try {
|
||||||
|
|
||||||
|
Mail::raw("Test Message", function ($message) {
|
||||||
|
$message->to(config('mail.from.address'))
|
||||||
|
->from(config('mail.from.address'), config('mail.from.name'))
|
||||||
|
->subject('Test Email');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
} catch(\Exception $e) {
|
||||||
|
$this->info("Error sending email: " . $e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,6 +117,7 @@ class StripeConnectController extends BaseController
|
|||||||
'refresh_token' => $response->refresh_token,
|
'refresh_token' => $response->refresh_token,
|
||||||
'access_token' => $response->access_token,
|
'access_token' => $response->access_token,
|
||||||
'appleDomainVerification' => '',
|
'appleDomainVerification' => '',
|
||||||
|
// "statementDescriptor" => "",
|
||||||
];
|
];
|
||||||
|
|
||||||
$company_gateway->setConfig($payload);
|
$company_gateway->setConfig($payload);
|
||||||
|
@ -41,6 +41,7 @@ class MailSentListener implements ShouldQueue
|
|||||||
*/
|
*/
|
||||||
public function handle(MessageSent $event)
|
public function handle(MessageSent $event)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!Ninja::isHosted()) {
|
if (!Ninja::isHosted()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ use Illuminate\Queue\SerializesModels;
|
|||||||
|
|
||||||
class TestMailServer extends Mailable
|
class TestMailServer extends Mailable
|
||||||
{
|
{
|
||||||
// use Queueable, SerializesModels;
|
|
||||||
|
|
||||||
public $support_messages;
|
public $support_messages;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user