Closed mailcare closed 1 year ago
@mailcare is this still an issue? i can fix it in my fork: https://github.com/joelharkes/laravel-mailbox
Yes still an issue, but the PR are not merged. I'm not sure Laravel mailbox is still used.
Please accept this PR! 👍
@joalea and @siebsie23 Im trying to solve it but i dont understand how this code would solve it.
When i read the documentation: https://mailcare.docs.apiary.io/#reference/0/automations-resource/automation-webhook
it suggests getting the email from data.sender.email not from php://input Do i have the right documentation?
@joelharkes To be honest I'm not sure. I just blindly merged it into my fork. But in theory the php://input should just get the full raw body of the email right?
As far as i understand, this would store the complete JSON in the message
field in the database, but not the actual EML file/ email file.
Im looking at how to get this but i do not see, even the get email api call seems to have no contents? you can only download attachements?
see: https://mailcare.docs.apiary.io/#reference/0/email-resource/get-an-email
Instead it seems like you have to checkbox the "Post the raw, full MIME message": https://github.com/mailcare/mailcare
Yes it works only if you check the checkbox "Post the raw, full MIME message".
A new PR has been created: https://github.com/beyondcode/laravel-mailbox/pull/114 and it has been fully tested.
@eXorus actually php://input
would have been required to get the full http headers and body. But that for example does not work with Laravel Octane.
Im not sure there is a proper solution for this. Only maybe this would work: https://stackoverflow.com/a/23447426/1275832
But you don't need to have the http headers, you only need the email body and Laravel mailbox will decode the email for you. It's exactly how the other drivers works: postmark with the rawemail attribute, sendgrid with the email attribute.
@eXorus the HTTP headers are equal to the Email headers, it contains who send the email and who received it ETC.
So they are picked up as HTTP headers and you will only get the Email HTML body and miss all the email context information
Sorry I don't understand, the other drivers works the same they send more information in a Json properties like subject or to but they are not used by laravel mailbox because Laravel mailbox use only the raw email (with email headers and bodies) to decode the subject...
So same for MailCare but I don't send the decoded subject, because laravel mailbox don't need it.
From a user point of view you will have all the emails headers and all the emails bodies.
No, the email headers are filtered out by PHP (as they are identical as HTTP header structure they are seen as HTTP headers).
I did some testing locally. When I have more time I'll make a proper PR to make it work in any circumstance although maybe not the ideal solution.
Found proper solution as i could get: doing $request->__toString()
It does add extra HTTP requests, maybe good fallback for php://input
@eXorus i was wrong it, does seem to POST the whole email message in the HTTP Body (it doesn not skip the HTTP request)
@eXorus my Fork supports it now with proper testing also: https://packagist.org/packages/joelharkes/laravel-mailbox
The MailCare driver doesn't work.
This PR will fix the issue.