Webmaster Forum  

Go Back   Webmaster Forum > Website Design Forum > Website Design Forum
User Name
Password
Register FAQ Members List Calendar Transactions Store Search Today's Posts Mark Forums Read


With this PHP code snippet you can show an email overview and display emails.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-10-2005, 10:25
admans
Senior Member


Join Date: Jul 2005
Posts: 248
Trader Rating: (0)
Points: 22 (Donate)
5 F$/Referral Refer Friends
admans is on a distinguished road
Default With this PHP code snippet you can show an email overview and display emails.

With this PHP code snippet you can show an email overview and display emails. This example has been written for POP3 accounts. If you're using an IMAP account just replace /pop3 with /imap/notls
PHP Code:
<?php
      
function show_mails($server$account$password)
      {
        
$mailbox imap_open("{".$server.":110/pop3}INBOX"$account$password);
        
$mails imap_fetch_overview($mailbox,"1:*"FT_UID); // This is fetching an overview of all emails

        // Output as a table:
        
$return '<table width="100%">
                     <tr>
                       <td><b>#</b></td>
                       <td><b>From</b></td>
                       <td><b>Date / Time</b></td>
                       <td><b>Subject</b></td>
                     </tr>'
;
        
$size count($mails); // Number of messages
        
$cmsg 0// This is used to have a continously number
        
for($i=$size-1;$i>=0;$i--)
        {
          
$cmsg++;
          
$value $mails[$i];
          
$return .= '<tr><td>'.$cmsg.'</td><td>'.$value->from.'</td><td>'.$value->date.'</td><td><a href="'.$_SERVER['PHP_SELF'].'?id='.$value->msgno.'">'.$value->subject.'</a></td></tr>';
        }
        
$return .= '</table>';
        
imap_close($mailbox);
        return 
$return;
      }

      function 
show_mail($id$server$account$password)
      {
        
$mailbox imap_open("{".$server.":110/pop3}INBOX"$account$password);
        
$mail imap_body($mailbox,$idFT_UID);
        
// This is fetching the email..
        
$mail htmlentities(stripslashes($mail));
        
/* stripslashes is stripping the slashes, htmlentities transforms all of the non-regular symbols to their equal html code expression. */
        
$return '<pre>'.$mail.'</pre>';
        
imap_close($mailbox);
        return 
$return;
      }

      if(isset(
$_GET['id']))
        if(
is_numeric($_GET['id']))
          echo 
show_mail($_GET['id'], "YourServerAddress""Account""Password");
        else
          echo 
'wrong parameter';
      else
        echo 
show_mails("YourServerAddress""Account""Password");
    
?>

Used functions:
Can be found at this web address (I'm technically not allowed to post links yet...): php.de/ftopic31562.html
__________________

http://img76.imageshack.us/img76/6450/sc2but4ng.gif | http://img495.imageshack.us/img495/...ogorwtan0je.gif | <a href="http://webtools.sc2.info"><img src="http://img129.imageshack.us/img129/8682/sc2webtan7ju.gif" border="1" width="100" alt="Free Webtools for all" /></a> | <a href="http://www.indexrated.com"><img src="http://img398.imageshack.us/img398/4813/listed1pb.gif" border="1" width="100" alt="Index Rated Directory - Rating Quality Sites" /></a>

Get all Games,Apps and Wallpapers Nokia, Samsung and Sony Erricson!!

admans is offline
Reply With Quote
  #2  
Old 08-31-2005, 17:26
commes
Senior Member

commes's Avatar

Join Date: Aug 2005
Location: Regina, Sask, Canada
Posts: 295
Trader Rating: (1)
Points: 76 (Donate)
5 F$/Referral Refer Friends
commes is on a distinguished road
Send a message via MSN to commes
Default Re: With this PHP code snippet you can show an email overview and display emails.

wow, thats an awesome find
__________________
Classic Auto's | Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here |
Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here |
Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here |
commes is offline
Reply With Quote
  #3  
Old 10-05-2005, 08:22
unknowngiver
Junior Member


Join Date: Jun 2005
Posts: 24
Trader Rating: (0)
Points: 4 (Donate)
5 F$/Referral Refer Friends
unknowngiver is on a distinguished road
Default Re: With this PHP code snippet you can show an email overview and display emails.

kool tutorial/code man
thanks for shairing
unknowngiver is offline
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Resources : | Advertise at FHF | itextLink.com| Reseller Hosting| TextDot| iNamePros| Any Webmaster| Web Host| Dep3| cheap low cost web hosting reviews|


All times are GMT -4. The time now is 02:41.


Powered by: vBulletin
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.