Skip to content

Commit

Permalink
add Class to check Smtp Connection v-2
Browse files Browse the repository at this point in the history
  • Loading branch information
elmarzouguidev committed Oct 18, 2023
1 parent 308410b commit 1bbc5a1
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions app/Services/Smtp/CheckSmtpConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@

namespace App\Services\Smtp;

use Illuminate\Support\Facades\Http;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;

class CheckSmtpConnection
{
public static function isConnected(): bool
{

/*if (!self::check(config('mail.mailers.smtp.host'))) {
return false;
}*/

try {
$transport = new EsmtpTransport(config('mail.mailers.smtp.host'), config('mail.mailers.smtp.port'), config('mail.mailers.smtp.encryption'));
$transport->setUsername(config('mail.mailers.smtp.username'));
Expand All @@ -26,16 +21,4 @@ public static function isConnected(): bool
return false;
}
}

private static function check($domainUrl): bool
{
try {
$response = Http::timeout(3)->get($domainUrl);

return $response->successful();
} catch (\Illuminate\Http\Client\ConnectionException $e) {

return false;
}
}
}

0 comments on commit 1bbc5a1

Please sign in to comment.