mail error capture (#113)

tweaked error catching to return a message when the mail action fails
This commit is contained in:
ro 2024-06-05 13:50:45 -06:00
parent b37e64d062
commit e0994b32ab
No known key found for this signature in database
GPG key ID: 29B551CDBD4D3B50

View file

@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
use App\Mail\SystemEmail;
use Symfony\Component\Mailer\Exception\TransportException;
class MailAPIController extends Controller
{
@ -23,10 +24,10 @@ class MailAPIController extends Controller
'type' => 'mail_good',
'message' => 'Mail Sent',
];
} catch (ERROR $e) {
} catch (TransportException $e) {
$result = [
'type' => 'mail_not_good',
'message' => 'Mail Not Sent',
'message' => 'Mail Not Sent. It\'s cool. Just check mail settings in the .env',
];
}