How to create or update an account and relate to a case

Hi,

I setup an inbound email to capture emails as cases. I want to relate created case to an existing account. If there is no account associated with the sender email, I want to create new account. Please let me know what should I do.
Thank you