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;
|
||||
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\DataMapper\DefaultSettings;
|
||||
use App\Jobs\Mail\NinjaMailerJob;
|
||||
use App\Jobs\Mail\NinjaMailerObject;
|
||||
use App\Mail\Migration\MaxCompanies;
|
||||
use Faker\Factory;
|
||||
use App\Models\User;
|
||||
use App\Models\Account;
|
||||
use App\Models\Company;
|
||||
use App\Models\User;
|
||||
use Faker\Factory;
|
||||
use App\Mail\TestMailServer;
|
||||
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
|
||||
{
|
||||
@ -55,39 +57,26 @@ class SendTestEmails extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$faker = Factory::create();
|
||||
|
||||
$account = Account::factory()->create();
|
||||
|
||||
$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,
|
||||
]);
|
||||
$to_user = User::first();
|
||||
|
||||
$nmo = new NinjaMailerObject;
|
||||
$nmo->mailable = new MaxCompanies($user->account->companies()->first());
|
||||
$nmo->company = $user->account->companies()->first();
|
||||
$nmo->settings = $user->account->companies()->first()->settings;
|
||||
$nmo->to_user = $user;
|
||||
$nmo->mailable = new TestMailServer('Email Server Works!', config('mail.from.address'));
|
||||
$nmo->company = $to_user->account->companies()->first();
|
||||
$nmo->settings = $to_user->account->companies()->first()->settings;
|
||||
$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,
|
||||
'access_token' => $response->access_token,
|
||||
'appleDomainVerification' => '',
|
||||
// "statementDescriptor" => "",
|
||||
];
|
||||
|
||||
$company_gateway->setConfig($payload);
|
||||
|
@ -41,6 +41,7 @@ class MailSentListener implements ShouldQueue
|
||||
*/
|
||||
public function handle(MessageSent $event)
|
||||
{
|
||||
|
||||
if (!Ninja::isHosted()) {
|
||||
return;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class TestMailServer extends Mailable
|
||||
{
|
||||
// use Queueable, SerializesModels;
|
||||
|
||||
public $support_messages;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user