Skip to content

Instantly share code, notes, and snippets.

@msaladna
Created August 9, 2019 17:22
Show Gist options
  • Save msaladna/8feeada8ac3edf4a08a3eef225a817e1 to your computer and use it in GitHub Desktop.
Save msaladna/8feeada8ac3edf4a08a3eef225a817e1 to your computer and use it in GitHub Desktop.
<?php
namespace App\Models;
use App\Http\Controllers\ServerLookupController;
use Illuminate\Contracts\Support\MessageBag;
class MailConfig {
const MY_DOMAIN = 'hostineer.com';
public static function lookup($domain) {
$server = 'mail.' . $domain;
$controller = \App::make(ServerLookupController::class);
$data = $controller->callAction('findDomain', ['domain' => $domain]);
if (!$data instanceof MessageBag) {
$server = $data;
}
return $server . '.' . ServerLookupController::MY_DOMAIN;
if (!$server) {
return 'mail.' . $domain;
}
return $server . '.' . ServerLookupController::MY_DOMAIN;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment