how to retrieve mails & attachment from mbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Watermark
    New Member
    • Mar 2007
    • 5

    how to retrieve mails & attachment from mbox

    i got problem with this
    i m implementing web based mail system.
    i want to access mbox and retrieve mail from it and display it on web page..

    can anybody help me.
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    Please elaborate a bit more on your problem and show the code you have developed to tackle this requirement.

    And show that code within php or code tags!!

    Ronald :cool:

    Comment

    • Watermark
      New Member
      • Mar 2007
      • 5

      #3
      how to retrieve mails from mbox using php

      i m implementing web based mail system using php.....
      now i can send mail and attachments. i tried this
      [php]
      <?php
      $to = "$name <$email>";
      $from = "John-Smith <john.smith@dom ain.com>";
      $subject = "Here is your attachment";

      $fileatt = "/public_html/pdfs/mypdf.pdf";
      $fileatttype = "applicatio n/pdf";
      $fileattname = "newname.pd f";

      $headers = "From: $from";

      $file = fopen( $fileatt, 'rb' );
      $data = fread( $file, filesize( $fileatt ) );
      fclose( $file );

      $semi_rand = md5( time() );
      $mime_boundary = "==Multipart_Bo undary_x{$semi_ rand}x";

      $headers .= "\nMIME-Version: 1.0\n" .
      "Content-Type: multipart/mixed;\n" .
      " boundary=\"{$mi me_boundary}\"" ;

      $message = "This is a multi-part message in MIME format.\n\n" .
      "--{$mime_boundary }\n" .
      "Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
      "Content-Transfer-Encoding: 7bit\n\n" .
      $message . "\n\n";

      $data = chunk_split( base64_encode( $data ) );

      $message .= "--{$mime_boundary }\n" .
      "Content-Type: {$fileatttype}; \n" .
      " name=\"{$fileat tname}\"\n" .
      "Content-Disposition: attachment;\n" .
      " filename=\"{$fi leattname}\"\n" .
      "Content-Transfer-Encoding: base64\n\n" .
      $data . "\n\n" .
      "--{$mime_boundary }--\n";

      if( mail( $to, $subject, $message, $headers ) ) {
      echo "<p>The email was sent.</p>";
      }
      else {
      echo "<p>There was an error sending the mail.</p>";
      }
      }
      ?>[/php]

      this sends attachment and encrypts it. also i want to retrieve mails from mbox
      now i want to retrieve it and display it on webpage.......
      can anybody help me plz......its my project

      Read the Posting Guidelines on double threads and enclosing code within php or code tags!! - moderator
      Last edited by ronverdonk; Mar 12 '07, 11:53 AM. Reason: code within php tags

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        That is a bit more complicated than sending emails with or without attachments.

        Please have a look at the following, very useful, tutorials on building a web based email client. I am sure you'll find what you need.

        Building-A-PHPBased-Mail-Client-part-1
        Building-A-PHPBased-Mail-Client-part-2
        Building-A-PHPBased-Mail-Client-part-3

        Ronald :cool:

        Comment

        • Watermark
          New Member
          • Mar 2007
          • 5

          #5
          accessing mails using php

          sir your linked soln was nice.but i m not using any mail client .so what i want is accessing mails through php without that imap_* functions... i want to implement it like yahoomail.com ie no spcific client s/w required like outlook express.

          i want to store mails on server & whenever user will request let them access that..
          what exactly i want is parse mbox on server with php and retrieve mails plus attachments on webpage like yahoo,gmail web based systems.

          plz give m a soln with example code.....
          plzz help me

          Comment

          • ronverdonk
            Recognized Expert Specialist
            • Jul 2006
            • 4259

            #6
            Do not start a new thread for the same subject! I have merged the threads.

            moderator

            Comment

            • ronverdonk
              Recognized Expert Specialist
              • Jul 2006
              • 4259

              #7
              Originally posted by Watermark
              sir your linked soln was nice.but i m not using any mail client .so what i want is accessing mails through php without that imap_* functions... i want to implement it like yahoomail.com ie no spcific client s/w required like outlook express.

              i want to store mails on server & whenever user will request let them access that..
              what exactly i want is parse mbox on server with php and retrieve mails plus attachments on webpage like yahoo,gmail web based systems.

              plz give m a soln with example code.....
              plzz help me
              If my post with links did not meet your requirement, maybe you can have a look at the email class of www.phpclasses.org. That contains a lot of email solutions, client and web based.

              These classes are free to download, change and use and I am sure you'll find code and samples that can be used by you. Look at Email classes

              Ronald :cool:

              Comment

              Working...