Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9221539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:36:06+00:00 2026-06-18T03:36:06+00:00

I am using a php class etodb found here http://www.phpclasses.org/package/3324-PHP-Retrieve-e-mail-messages-into-a-MySQL-database.html It checks an email

  • 0

I am using a php class etodb found here

http://www.phpclasses.org/package/3324-PHP-Retrieve-e-mail-messages-into-a-MySQL-database.html

It checks an email account and downloads the messages into a mysql database. It works perfectly, however at the end of each loop (looping for each message in the inbox) it deletes the email. I know how to stop it from deleting the email, but the issue is for some reason the script wont insert any new emails into the database unless I allow it to delete the messages OR the inbox is completely empty.

Here is the end portion of the php class referenced above. This section just loops through each message and inserts it into the database AND if set it will delete the messages. My question in summary is to just let the script work correctly without the need to delete messages or have an empty inbox.

$total_messages = $this->num_message(); 

// IM ASSUMING THIS FOR LOOP IS NOT LOOPING MESSAGES CORRECTLY 
for ($i = 0; $i < $total_messages; $i++) {


#Get first message
$email = $this->email_get();

$ismsgdb = $this->db_add_message($email); // THIS INSERTS EACH MSG INTO DATABASE

#Get store dir
$dir = $this->dir_name();

$id_log = $this->add_db_log($email, 'Copy e-mail - start ');

foreach($this->partsarray as $part){
 if($part[text][type] == 'HTML'){
   #$message_HTML = $part[text][string];
   $this->db_update_message($part[text][string], $type= 'HTML');
 }elseif($part[text][type] == 'PLAIN'){
   $message_PLAIN = $part[text][string];
   $this->db_update_message($part[text][string], $type= 'PLAIN');
 }elseif($part[attachment]){
    #Save files(attachments) on local disc

   // $message_ATTACH[] = $part[attachment];
    foreach(array($part[attachment]) as $attach){
        $attach[filename] = $this->mimie_text_decode($attach[filename]);
        $attach[filename] = preg_replace('/[^a-z0-9_\-\.]/i', '_', $attach[filename]);
        $this->add_db_log($email, 'Start coping file:"'.strip_tags($attach[filename]).'"');

        $this->save_files($this->newid.$attach[filename], $attach[string]);
        $filename =  $dir.$this->newid.$attach[filename];
        $this->db_add_attach($attach[filename], $filename);
        $this->update_db_log('<b>'.$filename.'</b>Finish coping: "'.strip_tags($attach[filename]).'"', $this->logid);
    }
  //

 }elseif($part[image]){
    #Save files(attachments) on local disc

    $message_IMAGE[] = $part[image];

    foreach($message_IMAGE as $image){
        $image[filename] = $this->mimie_text_decode($image[filename]);
        $image[filename] = preg_replace('/[^a-z0-9_\-\.]/i', '_', $image[filename]);
        $this->add_db_log($email, 'Start coping file: "'.strip_tags($image[filename]).'"');


        $this->save_files($this->newid.$image[filename], $image[string]);
        $filename =  $dir.$this->newid.$image[filename];
        $this->db_add_attach($image[filename], $filename);
        $this->update_db_log('<b>'.$filename.'</b>Finish coping:"'.strip_tags($image[filename]).'"', $this->logid);
    }

 }

}
$this->spam_detect();
$this->email_setflag(); 
$this->email_delete(); // WHEN I REMOVE THIS THE SCRIPT WONT GRAB NEW EMAILS
$this->email_expunge(); // WHEN I REMOVE THIS THE SCRIPT WONT GRAB NEW EMAILS




$this->update_db_log('Finish coping', $id_log);


}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:36:07+00:00Added an answer on June 18, 2026 at 3:36 am

    But your problem is that in the loop, you keep grabbing hte first email.

    #Get first message
    $email = $this->email_get();
    

    The class has an internal pointer “$this->msgid” that you need to increment to get the next message. If you set this to $i + 1 before calling the function you should get the next message.

    #Get message determined b $i
    $this->msgeid = $i + 1;
    $email = $this->email_get();
    

    (Note: edited, now seen the source)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this PHP class: http://www.phpclasses.org/browse/file/9524.html I use this code to make it work:
I'm using this php class ( http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php ) for creating the different sized images
Am using below third party API in my project development http://undesigned.org.za/2007/10/22/amazon-s3-php-class I have done
I am uploading video on twitvid using its official php library. http://www.martin-gardner.co.uk/twitvid/twitvid.class.example.php#embedvideo But when
I am using php class upload http://www.verot.net/php_class_upload.htm I want to and trying to upload
I'm using http://undesigned.org.za/2007/10/22/amazon-s3-php-class/documentation to access private files using php. I can get the data
I'm using a PHP class to generate vcard: http://www.troywolf.com/articles/php/class_vcard/ But accented character do not
I have send an email using php mailer class. mail was sending successfully but
I'm trying to send mail using phpMailer. It's my code: <?php require_once('phpmailer/class.phpmailer.php'); $mail =
I'm using a PHP class based on the one found in this answer to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.