added outlook mail support
This commit is contained in:
@@ -114,6 +114,7 @@ class ZEmail extends Model
|
||||
$settings = json_decode(config('app.settings.configuration_settings'), true);
|
||||
$forbidden_ids = $settings['forbidden_ids'] ?? [];
|
||||
$gmail_usernames = $settings['gmailUsernames'] ?? [];
|
||||
$outlook_usernames = $settings['outlookUsernames'] ?? [];
|
||||
$domains = $settings['domains'] ?? [];
|
||||
|
||||
if (in_array($username, $forbidden_ids)) {
|
||||
@@ -124,13 +125,31 @@ class ZEmail extends Model
|
||||
return ZEmail::generateRandomGmail(true);
|
||||
}
|
||||
|
||||
if ($username === '' && in_array($domain, ['outlook.com'])) {
|
||||
return ZEmail::generateRandomOutlook(true);
|
||||
}
|
||||
|
||||
$zemail = new ZEmail();
|
||||
|
||||
if ($username === '' && in_array($domain, $domains)) {
|
||||
return $zemail->generateRandomUsername().'@'.$domain;
|
||||
}
|
||||
|
||||
if (in_array($domain, ['outlook.com'])) {
|
||||
if (str_contains($username, '+')) {
|
||||
[$check_username, $post_username] = explode('+', $username, 2);
|
||||
|
||||
if (in_array($check_username, $outlook_usernames)) {
|
||||
$email = $username . '@' . $domain;
|
||||
} else {
|
||||
$email = $zemail->getRandomOutlookUser() . '+' . $post_username . '@' . $domain;
|
||||
}
|
||||
} else {
|
||||
$email = $zemail->getRandomOutlookUser() . '+' . $username . '@' . $domain;
|
||||
}
|
||||
ZEmail::storeEmail($email);
|
||||
return $email;
|
||||
}
|
||||
|
||||
if (in_array($domain, ['gmail.com', 'googlemail.com'])) {
|
||||
if (str_contains($username, '+')) {
|
||||
@@ -190,7 +209,10 @@ class ZEmail extends Model
|
||||
} else {
|
||||
$email = $zemail->getRandomGmailUser().'+'.$zemail->generateRandomUsername().'@googlemail.com';
|
||||
}
|
||||
} else {
|
||||
} elseif ($domain == "outlook.com") {
|
||||
$email = $zemail->getRandomOutlookUser().'+'.$zemail->generateRandomUsername().'@outlook.com';
|
||||
}
|
||||
else {
|
||||
$email = $zemail->generateRandomUsername() . '@' . $domain;
|
||||
}
|
||||
if ($store) {
|
||||
@@ -235,6 +257,15 @@ class ZEmail extends Model
|
||||
return $email;
|
||||
}
|
||||
|
||||
public static function generateRandomOutlook($store = true): string
|
||||
{
|
||||
$zemail = new ZEmail();
|
||||
$email = $zemail->getRandomOutlookUser().'+'.$zemail->generateRandomUsername().'@outlook.com';
|
||||
if ($store) {
|
||||
ZEmail::storeEmail($email);
|
||||
}
|
||||
return $email;
|
||||
}
|
||||
private static function storeEmail($email): void
|
||||
{
|
||||
Log::create([
|
||||
@@ -292,6 +323,11 @@ class ZEmail extends Model
|
||||
$count = count($gmailusername);
|
||||
return $count > 0 ? $gmailusername[rand(1, $count) - 1] : '';
|
||||
}
|
||||
private function getRandomOutlookUser() {
|
||||
$outlook_username = json_decode(config('app.settings.configuration_settings'))->outlookUsernames ?? [];
|
||||
$count = count($outlook_username);
|
||||
return $count > 0 ? $outlook_username[rand(1, $count) - 1] : '';
|
||||
}
|
||||
|
||||
private function generatePronounceableWord(): string
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user