Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 12th July 2010, 20:23
BorderAmigos BorderAmigos is offline
Senior Member
 
Join Date: Apr 2008
Location: San Diego & Tijuana
Posts: 302
Thanks: 26
Thanked 33 Times in 31 Posts
Send a message via MSN to BorderAmigos Send a message via Yahoo to BorderAmigos
 
Default ISPConfig 3, SquirrelMail Account checker...

If you use a lot of different email addresses in your business it can be a pain to check them all. I wrote this little script that will check all of the accounts listed in the $userIDs array. I have it on a Drupal page so if you want to run it standalone you may want to add the head, body, et cetera, to the html output.

Note that the passwords are visible in the generated source code so access to this page should be authenticated somehow. For me it is an admin only page in Drupal. With it I can tell at a glance if any of 80 email accounts has mail. Clicking on the account opens and logs in automatically. Remember to log out though.

Code:
<?php

// array of "usernames:passwords", should be on same server.
$userIDs=array(
"user@system6host.org:Password123",
"admin@system6hosting.net:Password456",
//  As many as you want...
"temp01a@american1.us:Password789"
);

$refresh='900';  // in seconds
$server='http://mail.'.$_SERVER["SERVER_NAME"];  // or IP address
$pageURL='http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];  

// The php headers function gives some errors in Drupal, meta doesn't
$output='<meta http-equiv="refresh" content="'.$refresh.';url='.$pageURL.'">';

$output .= '<script language="JavaScript" type="text/javascript">';
$output .= '<!--';
$output .= 'function squirrelmail_loginpage_onload() {';
$output .= 'document.forms[0].js_autodetect_results.value = \'1\';';
$output .= 'for (i = 0; i < document.forms[0].elements.length; i++) {';
$output .= 'if (document.forms[0].elements[i].type == "text" || document.forms[0].elements[i].type == "password") {';
$output .= 'document.forms[0].elements[i].focus();';
$output .= 'break;';
$output .= '}}}';
$output .= '// -->';
$output .= '</script>';

$output .= '<span style="font-size:2em;font-weight:bold;">'.date("D F d Y H:i:s",time()).'</span><br><br>';
$output .= '<form><input type="button" value="Back" onClick="history.go(-1);return true;"><input type="button" value="Refresh" onClick="location.reload(true);"></form><br>';
$output .= '<div onload="squirrelmail_loginpage_onload()" class="mailboxes" style"float:none;clear:both;">';
$output .= '<span display="inline">';
foreach ($userIDs as $userID) 
{
	$temp=explode(':',$userID);
	$address=$temp[0];
	$password=$temp[1];
	$imap = imap_open("{127.0.0.1:110/pop3/notls}INBOX", $address, $password);
	$info = imap_check($imap);
	$msgColor=($info->Nmsgs)?'color:#cc0000;':'color:#0000cc;';
	$msgColor.='background-color:#ffffff;';
	$output .=  '
	<form method="post" action="'.$server.'/webmail/src/redirect.php" target="_blank" style="margin:5px;float:left;">
		<input type="hidden" name="js_autodetect_results" value="0"><input type="hidden" name="just_logged_in" value="1">
		<input type="hidden" name="secretkey" size="10" value="'.$password.'">
		<input type="hidden" name="login_username" value="'.$address.'">
		<input type="submit" name="username" style="'.$msgColor.'height:20px;width:250px;text-align:right;font-size:0.85em;" value="'.$address.'&nbsp;&nbsp;('.$info->Nmsgs.')"> 
	</form>';
	imap_close($imap);
}
$output .= '</span></div>';
$output .= '<p style="float:none;clear:both;">&nbsp;</p>';
$output .= '<form><input type="button" value="Back" onClick="history.go(-1);return true;"><input type="button" value="Refresh" onClick="location.reload(true);"></form>';
print $output;
?>
__________________
System6Hosting.com, ISPConfig 3, Debian.

Last edited by BorderAmigos; 12th July 2010 at 21:44.
Reply With Quote
The Following User Says Thank You to BorderAmigos For This Useful Post:
falko (13th July 2010)
Sponsored Links
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Loads of mysql connections to dbispconfig StrikerNL General 2 5th March 2009 14:31
Proftp no account created. ISPconfig start warnings jackoob Installation/Configuration 13 20th December 2008 12:31
SquirrelMail on IspConfig: Can't send ai_77 Installation/Configuration 8 27th February 2007 08:39
Multiple email account with ispconfig and roundcube statiic Installation/Configuration 2 5th November 2006 08:50
can ispconfig account tables become corrupted? darthpaul General 3 24th March 2006 18:58


All times are GMT +2. The time now is 10:41.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.