Skip to content

Instantly share code, notes, and snippets.

@kashiwasan
Created January 12, 2012 12:16
Show Gist options
  • Save kashiwasan/1600182 to your computer and use it in GitHub Desktop.
Save kashiwasan/1600182 to your computer and use it in GitHub Desktop.
mailaddress generator for coreserver
<?php
/***************************
(c) mail address generator for coreserver
@author : kashiwasan <pc.kashiwasan@gmail.com>
****************************/
// ベースドメインを指定
$domain = "example.com";
// 名前の長さ(@より前)を指定
$nameCount = (int) 8;
// サブドメインの長さを指定
$subDomainCount = (int) 2;
// 転送先のメールアドレスを指定
$mailAddress = "receive@example.com";
// 使用するパスワード(共通)
$password = "password";
// 生成するメールアドレスの個数
$mailAddressCount = (int) 100;
// ランダム生成に使う文字列
$charList = "abcdefghijklmnopqrstuvwxyz0123456789";
for ($i=0; $i<$mailAddressCount; $i++)
{
echo getRandom($nameCount)."@".getRandom($subDomainCount).".".$domain.":".$password.":".$mailAddress."<br />";
}
function getRandom($string = 8)
{
global $charList;
mt_srand();
$result = "";
for($i = 0; $i < $string; $i++)
{
$result.= substr($charList, mt_rand(0, strlen($charList) - 1), 1);
}
return $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment