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

getAttachments() save the file with 0 bytes size #188

Open
n3omaster opened this issue Feb 24, 2017 · 0 comments · May be fixed by #201
Open

getAttachments() save the file with 0 bytes size #188

n3omaster opened this issue Feb 24, 2017 · 0 comments · May be fixed by #201

Comments

@n3omaster
Copy link

I'm using this Class since two years ago.
I want now save the attachments from the incoming email but it saves just the filename with cero data.

`
$attachments = $message->getAttachments();

if ($attachments !== false) {
foreach ($attachments as $attachment) {

                    var_dump($attachment);

                    $path = APPPATH . 'cache/uploads/' . $user->id;

                    if (!is_dir(APPPATH . 'cache/uploads/' . $user->id)) mkdir(APPPATH . 'cache/uploads/' . $user->id);

                    $name = $attachment->getFileName();

                    var_dump($name);

                    $data = $attachment->getData();

                    var_dump($data);

                    $mime = $attachment->getMimeType();
                    $size = $attachment->getSize();
                    $saved = $attachment->saveToDirectory($path);

                    //file_put_contents($path . "/asd.asd", $data);
                    $this->attach = true;
                }
            }`
klammbueddel pushed a commit to klammbueddel/Fetch that referenced this issue Oct 19, 2017
An email with an embedded email can have the following structure:

1: "text/plain"
2: "message/rfc822"
2: "multipart/mixed"
2.1: "text/plain"
2.2: "application/octet-stream"
2.3, "application/octet-stream"

Before this fix this structure was parsed as

1: "text/plain"
2: "message/rfc822"
2.1: "multipart/mixed"
2.1.1: "text/plain"
2.1.2: "application/octet-stream"
2.1.3, "application/octet-stream"

Hence, downloading attachments was not possible due to wrong part
identifiers

resolves tedious#188, tedious#43
@klammbueddel klammbueddel linked a pull request Oct 19, 2017 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant