mail error capture (#113)
tweaked error catching to return a message when the mail action fails
This commit is contained in:
parent
b37e64d062
commit
e0994b32ab
1 changed files with 3 additions and 2 deletions
|
@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use App\Mail\SystemEmail;
|
use App\Mail\SystemEmail;
|
||||||
|
use Symfony\Component\Mailer\Exception\TransportException;
|
||||||
|
|
||||||
class MailAPIController extends Controller
|
class MailAPIController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -23,10 +24,10 @@ class MailAPIController extends Controller
|
||||||
'type' => 'mail_good',
|
'type' => 'mail_good',
|
||||||
'message' => 'Mail Sent',
|
'message' => 'Mail Sent',
|
||||||
];
|
];
|
||||||
} catch (ERROR $e) {
|
} catch (TransportException $e) {
|
||||||
$result = [
|
$result = [
|
||||||
'type' => 'mail_not_good',
|
'type' => 'mail_not_good',
|
||||||
'message' => 'Mail Not Sent',
|
'message' => 'Mail Not Sent. It\'s cool. Just check mail settings in the .env',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue