Jump to content

Recommended Posts

hi guys,

 

I have a mail box that gets email from gmail (certain messages are set to auto forward to this email address).

The php code to read from the inbox is below.

 

$imap = imap_open("{mail.domain.com:143/notls}INBOX", "[email protected]", "password");
$message_count = imap_num_msg($imap);
$message_count = 1;
for ($i = 1; $i <= $message_count; ++$i) {
        $header = imap_header($imap, $i);
       $body = imap_body($imap, $i);
        $prettydate = date("d/m/Y H:i", $header->udate);
        if (isset($header->from[0]->personal)) {
            $personal = $header->from[0]->personal;
        } else {
            $personal = $header->from[0]->mailbox;
        }
        $email = "$personal <{$header->from[0]->mailbox}@{$header->from[0]->host}>";
        $debody = base64_decode($body);
    }

 

The problem is, when the email is read some certain characters are added (replaced I think). Especially "=A0". But in the original email it is not there.

I tried str_replace just to take them off, but no effect.

 

Original message is displayed like

Ticker Coupon Maturity    B/O  Price      B/O  Yield  Mid ASW Mid Z Axe

------------------------------------------------------------------------------

AGILE  8.875  28-Apr-17  100.750/101.750  8.705 /8.485  629.4  667

CENCHI 12.25  20-Oct-15  103.750/104.750  11.125/10.837 942.5  975

CHOGRP 7      17-Nov-17  92.000 /93.000  8.650 /8.434  570.9  641

CITIC  6.75  15-May-14  103.000/104.000  5.613 /5.244  443.9  450

CITPAC 7.875  15-Apr-49  99.500 /100.000  7.998 /7.871  596.7  632

COGARD 10.5  11-Aug-15  103.750/104.750  9.379 /9.091  774.2  796

COGARD 11.25  22-Apr-17  103.750/104.750  10.371/10.145 809.0  846

 

Php displays it like

Ticker Coupon Maturity =A0 =A0 B/O =A0 Price =A0= =A0 =A0B/O =A0Yield =A0Mid ASW Mid Z Axe

------------------------------= ------------------------------------------------

AGILE =A08.875 =A028-Ap= r-17 =A0100.750/101.750 =A08.705 /8.485 =A0629.4 =A0 667

CENCHI 12.25 =A020-Oct-15 =A0103.750/104.750 =A011.125/10.837 942.5 =A0 975=

CHOGRP 7 =A0 =A0 =A017-Nov-17 =A092.000 /93.000 =A0 8.650 /8.434 =A0570= .9 =A0 641

CITIC =A06.75 =A0 15-May-14 =A0103.000/104.000 =A05.613 /5.24= 4 =A0443.9 =A0 450

CITPAC 7.875 =A015-Apr-49 =A099.500 /100.000 =A07.998= /7.871 =A0596.7 =A0 632

COGARD 10.5 =A0 11-Aug-15 =A0103.750/104.750 =A09.379 /9.091 =A0774.2 =A0 7= 96

 

Could it be some thing to do with html formatting special characters in some way?

 

Any help is greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/239391-help-with-reading-mail/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.