Open vmitchell85 opened 5 years ago
Having the same problem.
I have set up the AppSerivceProvider like this:
Mailbox::to('{token}@in.myapp.com', Email::class);
However nothing is stored, and the Email class is never fired. If I change it to:
Mailbox::from('myemail@hotmail.com', Email::class);
It works just fine.
I've done a bunch of testing and it seems the issue has to do with the URL being used for the incoming emails that is referenced in #28.
It seems that Mailgun is sending a different style of information when an email comes in via email than it does even using their Send A Sample POST
feature on their website.
I tried to modify the URL in BeyondCode\Mailbox\Drivers\Mailgun.php
to not end with mime
with no luck, I keep getting a 302 redirect instead of a 200 for some reason.
I'm going to keep hunting but maybe this helps further narrow down the issue.
I've determined the redirect is due to the validator. The non-mime URLs/Mailgun POSTs doesn't include body-mime
. Changing this to use body-html
did not work.
It seems to me a new mailgun non-mime driver should probably be created in order to work properly. So this issue could probably be combined with #28.
I have the same issue using Postmark. It looks like the library is not parsing correctly the message headers.
I've come with a solution (which probably needs some testing with emails sent from different providers)
private function getTo(string $raw): string
{
$matches = [];
preg_match("/\[\"To\",\"(.*?)\"\]/", $raw, $matches);
return $matches[1];
}
So you can get the to header using: $this->getTo(json_encode($email->message()->getRawHeaders()))
Anyway, I'll keep digging it to see if I get to the source of the problem, because if the other headers are working, this should too.
$email->message()->getHeader('To')->getValue()
This also seems to work
Any news?
I'm trying to get this setup using an incoming "to" as such:
The mailbox was never matching, so I created a catch all to test it out:
The catch all seems to be working but the email does not seem to be parsed correctly.
Contents of CatchAllMailbox.php
Log Result
The
to
list seems to be empty, however if i take the stored message from the database and decode the base64 I can see therecipient
field is set toc8896a6b-be27-49d3-afed-950a11540189@mydomain.com