Version: 2.9
Type: Full Script
Category: Other
License: Other
Description: Dit script kan:
~Overzicht van mailtjes weergeven
~Mailtjes verwijderen
~Mailtjes verzenden via smtp
~POP3 en SMTP adres en poort kunnen door gebruiker opgegeven worden
~geen variables vooraf instellen
~Base64 coded mailtjes openen
~Weergeven of er bijlages zijn
~Bijlages openen
~Cc en Bcc
~source van de mail weergeven
~priority van de mail weergeven
~embedded images weergeven
~kiezen tussen tekst en html weergave
~urls in de tekst worden automatisch omgezet in links
~controle na het inloggen
~meerdere mailtjes tegelijk verwijderen
~html mailtjes verzenden met een wysiwyg editor
~bijlages verzenden
~prioriteit mail verzenden
TODO:
~embedded images verzenden
Het script is te bekijken op:
http://62.58.118.175/mail/
Het script is te downloaden op:
http://62.58.118.175/mail.zip
Voor de nieuwste versie kan je kijken op:
http://www.phpfreakz.nl/library.php?sid=14877
/////////////////////// // index.php // /////////////////////// <?php session_start(); $_SESSION = array(); //uitloggen indien ingelogt ?> <form name="inlogformulier" method="post" action="mail.php"> POP3 server: <input name="pop3" type="text" value="pop3.jouwserver.nl"> Poort: <input name="pop3poort" type="text" value="110"><br> SMTP server: <input name="smtp" type="text" value="smtp.jouwserver.nl"> Poort: <input name="smtppoort" type="text" value="25"> Authentification: <select size="1" name="auth"><option selected>none</option><option>login</option><option>plain</option></select><br> username: <input name="username" type="text"><br> password: <input name="wachtwoord" type="password"><br> <input type="submit" name="submit" value="Inloggen"> </form> /////////////////////// // mail.php // /////////////////////// <?php require 'mail_header.php'; require 'connect_pop3.php'; include 'mail_menu.php'; include 'disconnect_pop3.php'; ?> Welcome on this online email system. /////////////////////// // mail_header.php // /////////////////////// <?php session_start(); set_time_limit(60); if(isset($_POST["wachtwoord"])){ $_SESSION['wachtwoord'] = $_POST['wachtwoord']; } if(isset($_POST['username'])){ $username=$_POST['username']; $_SESSION['username']=$_POST['username']; } if(isset($_POST["pop3"])){ $_SESSION['pop3'] = $_POST['pop3']; $_SESSION['pop3poort'] = $_POST['pop3poort']; $_SESSION['smtp'] = $_POST['smtp']; $_SESSION['smtppoort'] = $_POST['smtppoort']; $_SESSION['auth'] = $_POST['auth']; } if(!isset($_SESSION['username'])){ die('You have to login to see this page!'); } $pop3_wachtwoord=$_SESSION['wachtwoord']; $pop3_user=$_SESSION['username']; $pop3_server=$_SESSION['pop3']; $pop3_port=$_SESSION['pop3poort']; $smtp_server=$_SESSION['smtp']; $smtp_port=$_SESSION['smtppoort']; $auth=$_SESSION['auth']; $input_vars = array('from','to','cc','bcc','subject','text','html','mailid','delid','file','contenttype','mspriority'); foreach ($input_vars as $var) { if (!empty($_REQUEST[$var])) { ${$var} = $_REQUEST[$var]; } else { ${$var} = NULL; } } ?> /////////////////////// // mail_menu.php // /////////////////////// <table width=100%><tr><th><a href="mail_overview.php">inbox</a></th> <th><a href="mail_compose.php">compose</a> (<a href="mail_compose.php?contenttype=text">text</a>/<a href="mail_compose.php?contenttype=html">html</a>)</th> <th><a href="index.php">logout</a></th></tr></table> /////////////////////// // mail_overview.php // /////////////////////// <?php require 'mail_header.php'; require 'connect_pop3.php'; include 'mail_menu.php'; // STATUS $buffer="STATrn"; fputs($mailserver,$buffer); $buffer=fgets($mailserver,512); $mailsum=substr($buffer,4,2); $mailmem=substr($buffer,6,strlen($buffer)-6); // status information echo '<table border=0 width=400> <tr bgcolor="#C0C0C0"> <td>number of mails</td> <th align=left>' . $mailsum . '</th> </tr> <tr bgcolor="#E0E0E0"> <td>mailboxsize</td> <th align=left>'.$mailmem.' bytes</th> </tr> </table>'; echo '<form method="POST" action="mail_delete.php"><input type="submit" value="Delete" name="delete"><table border=1><tr><th></th><th>Priority</th><th>From</th><th>Subject</th><th>Format</th><th>Date</th><th>Attachment</th><th></th><th></th></tr>'; for($nr=1;$nr<=$mailsum;$nr++){ $buffer="RETR " . $nr . "n"; fputs($mailserver,$buffer); $bijlage=false; $text=false; $html=false; $priority=3; $bijlagenaam=array(); while($buffer<>".rn"){ $buffer=fgets($mailserver,512); if(substr($buffer,0,11)=='X-Priority:'){$priority=substr($buffer,12,1);} if(substr($buffer,0,5)=='From:'){$from=htmlspecialchars(substr($buffer,6,strlen($buffer)));} if(substr($buffer,0,8)=='Subject:'){$subject=htmlspecialchars(substr($buffer,9,strlen($buffer)));} if(substr($buffer,0,5)=='Date:'){$date=htmlspecialchars(substr($buffer,6,strlen($buffer)));} if(substr($buffer,0,13)=='Content-Type:'){ $type=substr($buffer,14,strpos($buffer,';')-14); if($type=='text/plain'){ $text=true; }elseif($type=='text/html'){ $html=true; }else{ $bijlage=true; } } //Content-Type: is bijvoorbeeld image/jpeg if($bijlage and strpos($buffer,"tname="")!==false){$bijlagenaam[]=substr($buffer,strpos($buffer,'name=')+6,strpos($buffer,""rn")-strpos($buffer,'name=')-6);} } echo '<tr><td><input type="checkbox" name="delid[]" value="'.$nr.'"></td>'; if(intval($priority) < 3 and intval($priority) > 0){ echo '<td bgcolor="#C0C0C0" align=center>High</td>'; }elseif(intval($priority) > 3 and intval($priority) < 6){ echo '<td align=center>Low</td>'; }else{ echo '<td bgcolor="#E0E0E0" align=center>Normal</td>'; } echo '<td>'.$from.'</td><td><a href="mail_view.php?mailid='.$nr.'" target="_blank">'.$subject.'</a></td><td>'; if($text){echo ' <a href="mail_view.php?mailid='.$nr.'&contenttype=text" target="_blank">text</a> ';} if($html){echo ' <a href="mail_view.php?mailid='.$nr.'&contenttype=html" target="_blank">html</a> ';} echo '</td><td>'.$date.'</td><td>'; if($bijlage==true and count($bijlagenaam)>0){ for($i=0;$i<count($bijlagenaam);$i++){ echo('<a href="mail_file.php?mailid='.$nr.'&file='.$bijlagenaam[$i].'" target="_blank">'.$bijlagenaam[$i].'</a><br>'); } }else{ echo 'No'; } echo '</td><td><a href="mail_source.php?mailid='.$nr.'" target="_blank">Source</a></td><td><a href="mail_delete.php?delid='.$nr.'">Delete</a></td></tr>'; } echo '</table><input type="submit" value="Delete" name="delete"></form>'; include 'disconnect_pop3.php'; ?> /////////////////////// // mail_view.php // /////////////////////// <?php require 'mail_header.php'; require 'connect_pop3.php'; $a=0; $type=''; $tekst=''; $html=''; $oboundary=''; $iboundary=''; $base64=false; $buffer="RETR ".$mailid."rn"; fputs($mailserver,$buffer); while($buffer<>".rn"){ $buffer=fgets($mailserver,512); if(strpos($buffer,'Content-Transfer-Encoding: base64')!==false){$base64=true;} if(substr($buffer,0,24)=='Content-Type: text/plain'){$type='text';$tekst='';$a=1;} if(substr($buffer,0,23)=='Content-Type: text/html'){$type='html';$html='';$a=1;} if(substr($buffer,0,29)=='Content-Type: multipart/mixed'){$type='mixed';} if(substr($buffer,0,35)=='Content-Type: multipart/alternative'){$type='alternative';} if($type=='mixed' and strpos($buffer,'boundary="')!==false){$oboundary='';eregi("boundary="(.*)"", $buffer, $oboundary);} elseif(strpos($buffer,'boundary="')!==false){$iboundary='';eregi("boundary="(.*)"", $buffer, $iboundary);} if($a==2 and $type=='text' and $buffer==".rn"){$a=3;} if($a==2 and is_array($iboundary) and strpos($buffer,$iboundary[1])!==false){$a=3;} if($a==2 and is_array($oboundary) and strpos($buffer,$oboundary[1])!==false){$a=3;} if($a==2 and $type=='text'){$tekst.=$buffer;} if($a==2 and $type=='html'){ if($base64){ $html.=base64_decode($buffer); }else{ $html.=$buffer; } } if($a==1 and $buffer=="rn"){$a=2;} } $find =array("=20rn", "=rn","=3D"); $replace=array(" " , "" ,"="); $tekst=nl2br(htmlspecialchars(str_replace($find,$replace,$tekst))); $html=str_replace($find,$replace,$html); if($contenttype!='html' and $tekst<>''){ $tekst = ereg_replace('[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]','<a href=" ">