imap_fetchbody return strange string

204 Views Asked by At

I'm having some problems with getting the message body from an email. I've searched for solutions but have still not found the solution. Below is the code

$imap_conn = imap_open('{imap.gmail.com:993/imap/ssl}INBOX','user','password');
$inbox = imap_search($imap_conn, 'ALL');

if (! empty($inbox)) {
    foreach($inbox as $email_number) {

        $message = imap_fetchbody($imap_conn,415,1.1);
        var_dump($message);
    }

The problem is that the $message variable comes with a strange big string value instead of coming with the message value. I would like to have the body part of the email that we write when sending an email.

This is the value i get: RXN0ZSBldmVudG8gZm9pIGFsdGVyYWRvLg0KDQpUw610dWxvOiBSZXVuacOjbyBUw6ljbmljYSBP bnMzDQpRdWFuZG86IHF1aS4gMzAgU2V0LiAycG0g4oCTIHNleC4gMSBPdXQuIDIwMjEgN3BtIEhv cmEgZGEgRXVyb3BhIE9jaWRlbnRhbCAtICANCkxpc2JvYSAoYWx0ZXJhZG8pDQpDYWxlbmTDoXJp bzogbWFyY28uc2lsdmFAb25zZWFyY2

0

There are 0 best solutions below