send the verification email
i use "realmofthemadgod.appspot.com/char/verify?guid=fdfdfdfd@drdrb.com&password=123456"
conformation email reply link
"realmofthemadgod.appspot.com/account/v?b=4J314rX27VKa3za_&a=59222229345153718" <--random
imap php
it has some features like ignore duplicate verification emails (uses most recent) and it shows which mule it is working on
i use "realmofthemadgod.appspot.com/char/verify?guid=fdfdfdfd@drdrb.com&password=123456"
conformation email reply link
"realmofthemadgod.appspot.com/account/v?b=4J314rX27VKa3za_&a=59222229345153718" <--random
imap php
it has some features like ignore duplicate verification emails (uses most recent) and it shows which mule it is working on
Code:
<?php
// requirements:
// sudo apt-get install php5-imap php5-curl
/* connect to gmail */
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$username = 'user@domain.com';
$password = 'foo';
/* try to connect */
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
/* grab emails */
$emails = imap_search($inbox,'SUBJECT "Verify email for Realm of the Mad God" SINCE "12 September 2013"');
$total = count($emails);
$current = 0;
/* if emails are returned, cycle through each... */
if($emails) {
/* put the newest emails on top */
rsort($emails);
/* for every email... */
foreach($emails as $email_number) {
/* get information specific to this email */
$overview = imap_fetch_overview($inbox,$email_number,0);
$emailto = $overview[0]->to;
$message = imap_fetchbody($inbox,$email_number,1);
preg_match_all('/.+realmofthemadgod.appspot.com\/account\/v.+/', $message, $matches);
$url = $matches[0][0];
$data = array('email' => $emailto,'url'=>$url);
$output[] = $data;
$urls[] = $url;
$current++;
echo "reading email: $current of $total $emailto \n";
}
/* close the connection */
imap_close($inbox);
$muleguids=array();
foreach ($output as $entry) {
if (in_array($entry["email"],$muleguids)) {
//mule guid already in array
}
else {
// var_dump($entry);
$muleguids[] = $entry["email"];
$unique[]=$entry;
}
}
$uniquecount = count($unique);
$count = 0;
foreach ($unique as $entry) {
$returned_content = get_data($entry["url"]);
$count++;
$good = preg_match("/Thank you!/",$returned_content);
if ( $good == true ) {
echo "verify success: $count of $uniquecount ".$entry["email"]."\n";
}
else {
echo "verify failure: $count of $uniquecount ".$entry["email"]."\n";
}
}
}
/* gets the data from a URL */
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
?>
since the verification urls dont change its fine to reuse them

it could be more efficient though by ignoring already ready emails:
Code:
$emails = imap_search($inbox,'NEW SUBJECT "Verify email for Realm of the Mad God" SINCE "12 September 2013"');
#16 · edited ·
