added outlook mail support
This commit is contained in:
@@ -240,6 +240,7 @@ class Premium extends Model
|
||||
$settings = json_decode(config('app.settings.configuration_settings'), true);
|
||||
$forbidden_ids = $settings['forbidden_ids'] ?? [];
|
||||
$gmail_usernames = $settings['premium_gmailUsernames'] ?? [];
|
||||
$outlook_usernames = $settings['premium_outlookUsernames'] ?? [];
|
||||
$domains = $settings['premium_domains'] ?? [];
|
||||
|
||||
if (in_array($username, $forbidden_ids)) {
|
||||
@@ -250,13 +251,31 @@ class Premium extends Model
|
||||
return self::generateRandomGmail(true);
|
||||
}
|
||||
|
||||
if ($username === '' && in_array($domain, ['outlook.com'])) {
|
||||
return self::generateRandomOutlook(true);
|
||||
}
|
||||
|
||||
$zemail = new Premium();
|
||||
|
||||
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;
|
||||
}
|
||||
self::storeEmail($email);
|
||||
return $email;
|
||||
}
|
||||
|
||||
if (in_array($domain, ['gmail.com', 'googlemail.com'])) {
|
||||
if (str_contains($username, '+')) {
|
||||
@@ -314,7 +333,10 @@ class Premium 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) {
|
||||
@@ -358,6 +380,16 @@ class Premium extends Model
|
||||
}
|
||||
return $email;
|
||||
}
|
||||
|
||||
public static function generateRandomOutlook($store = true): string
|
||||
{
|
||||
$zemail = new Premium();
|
||||
$email = $zemail->getRandomOutlookUser().'+'.$zemail->generateRandomUsername().'@outlook.com';
|
||||
if ($store) {
|
||||
self::storeEmail($email);
|
||||
}
|
||||
return $email;
|
||||
}
|
||||
private static function storeEmail($email): void
|
||||
{
|
||||
Log::create([
|
||||
@@ -410,6 +442,11 @@ class Premium 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'))->premium_outlookUsernames ?? [];
|
||||
$count = count($outlook_username);
|
||||
return $count > 0 ? $outlook_username[rand(1, $count) - 1] : '';
|
||||
}
|
||||
private function generatePronounceableWord(): string
|
||||
{
|
||||
$c = 'bcdfghjklmnprstvwz'; //consonants except hard to speak ones
|
||||
|
||||
Reference in New Issue
Block a user