Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get raw message #161

Closed
RikudouSage opened this issue Jul 20, 2017 · 6 comments
Closed

Get raw message #161

RikudouSage opened this issue Jul 20, 2017 · 6 comments
Milestone

Comments

@RikudouSage
Copy link

Hello, I didn't find any way to get the raw message output, can you add it?

It's easy, you just omit the $section parameter of imap_fetchbody() and it fetches the whole raw e-mail.

@Lewiscowles1986
Copy link

Lewiscowles1986 commented Sep 28, 2017

I added the following to src/Message/Part.php

    public function getRAW() {
      return imap_fetchbody(
        $this->stream,
        $this->messageNumber,
        null,
        \FT_PEEK
      );
    }

seems to work and it's pretty fast. @Slamdunk, would this help with the tracking down of problems? I can PR it in. It's a tiny change (right now I'm using it to DL all the email)

@Slamdunk
Copy link
Collaborator

Yes: can you add test and creare a PR?

@Lewiscowles1986
Copy link

Looks like it'll need a few. Already seeing this in logs...

PHP Warning:  imap_fetchbody(): Bad message number in /projects/CODESIGN2/email-harvest/vendor/ddeboer/imap/src/Message/Part.php on line 334
PHP Stack trace:
PHP   1. {main}() /projects/CODESIGN2/email-harvest/harvest.php:0
PHP   2. Ddeboer\Imap\Message\Part->getRAW() /projects/CODESIGN2/email-harvest/harvest.php:34
PHP   3. imap_fetchbody() /projects/CODESIGN2/email-harvest/vendor/ddeboer/imap/src/Message/Part.php:334

@Lewiscowles1986
Copy link

I'm beginning to worry that a lot of my problems are with my mail host...

@Lewiscowles1986
Copy link

Lewiscowles1986 commented Sep 28, 2017

Does this get the entire message body including attachments? It looks a bit like it is.

@Slamdunk Slamdunk added this to the 1.0 milestone Sep 29, 2017
@Slamdunk
Copy link
Collaborator

Implemented in #146

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants