mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Add feature to send test e-mails
This commit is contained in:
parent
ccec991f6c
commit
61a9139bf0
@ -1,6 +1,7 @@
|
|||||||
<?php namespace BookStack\Http\Controllers;
|
<?php namespace BookStack\Http\Controllers;
|
||||||
|
|
||||||
use BookStack\Auth\User;
|
use BookStack\Auth\User;
|
||||||
|
use BookStack\Notifications\TestEmail;
|
||||||
use BookStack\Uploads\ImageRepo;
|
use BookStack\Uploads\ImageRepo;
|
||||||
use BookStack\Uploads\ImageService;
|
use BookStack\Uploads\ImageService;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@ -123,4 +124,20 @@ class SettingController extends Controller
|
|||||||
|
|
||||||
return redirect('/settings/maintenance#image-cleanup')->withInput();
|
return redirect('/settings/maintenance#image-cleanup')->withInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action to send a test e-mail to the current user.
|
||||||
|
* @param Request $request
|
||||||
|
* @param User $user
|
||||||
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
|
*/
|
||||||
|
public function sendTestEmail(Request $request)
|
||||||
|
{
|
||||||
|
$this->checkPermission('settings-manage');
|
||||||
|
|
||||||
|
user()->notify(new TestEmail());
|
||||||
|
$this->showSuccessNotification(trans('settings.maint_send_test_email_success', ['address' => user()->email]));
|
||||||
|
|
||||||
|
return redirect('/settings/maintenance#image-cleanup')->withInput();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
18
app/Notifications/TestEmail.php
Normal file
18
app/Notifications/TestEmail.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php namespace BookStack\Notifications;
|
||||||
|
|
||||||
|
class TestEmail extends MailNotification
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the mail representation of the notification.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||||
|
*/
|
||||||
|
public function toMail($notifiable)
|
||||||
|
{
|
||||||
|
return $this->newMailMessage()
|
||||||
|
->subject(trans('settings.maint_send_test_email_mail_subject'))
|
||||||
|
->greeting(trans('settings.maint_send_test_email_mail_greeting'))
|
||||||
|
->line(trans('settings.maint_send_test_email_mail_text'));
|
||||||
|
}
|
||||||
|
}
|
@ -63,6 +63,13 @@ return [
|
|||||||
'maint_image_cleanup_warning' => ':count potentially unused images were found. Are you sure you want to delete these images?',
|
'maint_image_cleanup_warning' => ':count potentially unused images were found. Are you sure you want to delete these images?',
|
||||||
'maint_image_cleanup_success' => ':count potentially unused images found and deleted!',
|
'maint_image_cleanup_success' => ':count potentially unused images found and deleted!',
|
||||||
'maint_image_cleanup_nothing_found' => 'No unused images found, Nothing deleted!',
|
'maint_image_cleanup_nothing_found' => 'No unused images found, Nothing deleted!',
|
||||||
|
'maint_send_test_email' => 'Send a Test E-Mail',
|
||||||
|
'maint_send_test_email_desc' => 'This sends a test e-mail to your e-mail address specified in your profile.',
|
||||||
|
'maint_send_test_email_run' => 'Send test e-mail',
|
||||||
|
'maint_send_test_email_success' => 'E-Mail sent to :address',
|
||||||
|
'maint_send_test_email_mail_subject' => 'Test E-Mail',
|
||||||
|
'maint_send_test_email_mail_greeting' => 'E-Mail delivery seems to work!',
|
||||||
|
'maint_send_test_email_mail_text' => 'Congratulations! As you received this e-mail notification, your e-mail settings seem to be configured properly.',
|
||||||
|
|
||||||
// Role Settings
|
// Role Settings
|
||||||
'roles' => 'Roles',
|
'roles' => 'Roles',
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="image-cleanup" class="card content-wrap auto-height">
|
<div id="image-cleanup" class="card content-wrap auto-height">
|
||||||
<h2 class="list-heading">{{ trans('settings.maint_image_cleanup') }}</h2>
|
<h2 class="list-heading">{{ trans('settings.maint_image_cleanup') }}</h2>
|
||||||
<div class="grid half gap-xl">
|
<div class="grid half gap-xl">
|
||||||
@ -44,5 +43,20 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="send-test-email" class="card content-wrap auto-height">
|
||||||
|
<h2 class="list-heading">{{ trans('settings.maint_send_test_email') }}</h2>
|
||||||
|
<div class="grid half gap-xl">
|
||||||
|
<div>
|
||||||
|
<p class="small text-muted">{{ trans('settings.maint_send_test_email_desc') }}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<form method="POST" action="{{ url('/settings/maintenance/send-test-email') }}">
|
||||||
|
{!! csrf_field() !!}
|
||||||
|
<button class="button outline">{{ trans('settings.maint_send_test_email_run') }}</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@stop
|
@stop
|
||||||
|
@ -172,6 +172,7 @@ Route::group(['middleware' => 'auth'], function () {
|
|||||||
// Maintenance
|
// Maintenance
|
||||||
Route::get('/maintenance', 'SettingController@showMaintenance');
|
Route::get('/maintenance', 'SettingController@showMaintenance');
|
||||||
Route::delete('/maintenance/cleanup-images', 'SettingController@cleanupImages');
|
Route::delete('/maintenance/cleanup-images', 'SettingController@cleanupImages');
|
||||||
|
Route::post('/maintenance/send-test-email', 'SettingController@sendTestEmail');
|
||||||
|
|
||||||
// Users
|
// Users
|
||||||
Route::get('/users', 'UserController@index');
|
Route::get('/users', 'UserController@index');
|
||||||
|
Loading…
Reference in New Issue
Block a user