$body .= $part->body; } } } if (preg_match('/<([^>]+)>/', $decoded->headers['from'], $regs)) { $from = $regs[1]; } else { $from = $decoded->headers['from']; } $id = $wtsk->comment($message_id, $body, $from); if (!$id) { echo $wtsk->error . "\n"; } else { $erase = true; foreach ($attachments as $attachment) { $res = $wtsk->attach($message_id, $attachment['type'], $attachment['name'], '', $attachment['body'], $attachment['mime']); if (!$res) { echo $wtsk->error . "\n"; $erase = false; } } if ($erase) { $pop3->removeMessage($number); } } break; } // end switch ($message_type) } $pop3->disconnect();