I have a process which has been checking an imap server for messages and the processing the emails if found.

The process looks for a HTML attachment and then processes the file, stripping out the data and inserting into a database.

This has been working fine up until now where it looks like the attachment has a different encoding than it previously did and is now calling a different function which is failing with this error:

Fatal error: Call to undefined function imap_7bit()
I am using the code below which I found on the php.net website on the PHP documentation page for imap_fetchbody.

I believe it is related to my version of PHP installed on my server and the additional modules I do or do not have.

I'm looking for an alternative if I can't use this:

PHP Code:
        //If we have an attachment and it is HTML let's continue
if ($partObject->ifdisposition == && $partObject->subtype == 'HTML') {
// fetch data from email part 
$data imap_fetchbody($this->mbox,$mid,$partno);
            switch (
$partObject->encoding) {
$data imap_7bit($data);
$data imap_8bit($data);
$data imap_binary($data);
$data imap_base64($data);
$data quoted_printable_decode($data);
$data $data;