Accessing the ID of an inbound email
Hi,
I'd like to store some incoming mails after parsing them, but I'd like to have a reference to them in the data I create from the parsed mail. IE the model ID the InboundEmail model that I get in my Mailbox (not the mail ID).
The InboundEmail is not yet persisted once it reaches my mailbox, is there any issues with calling $inboundEmail->save(); within the mailbox? This would allow me to get the ID and store the reference to the raw mail.
Cheers,
Hello,
Your question is a little old, but since it has no answer and I'm facing a similar situation - I need the Email's id in my mailbox route handler. There is no issue in calling $inboundEmail->save(); there, apart from the fact that it duplicates the call in Routing/Router::storeEmail() (which is called after the route handler - there).
Is there a reason, @mpociot, why storeEmail() is not called before the route handler?
Another solution would be the message_id attribute, but that is only assigned upon the model's creating event... That is, while saving, which boils down to the same problem.
@pecuchet & @JapSeyz could you not access the the id's in the created eloquent event?