I would use the word "by" to mean the author of something, like By John Smith, or the means to travel, such as by car, by boat, by plane, or even by phone, by mail. So it's the person or the vehicle that is the way something is done or sent or transported.
I would use "for" when I'm talking about something I do to help someone or to serve some purpose. I answered this question FOR you. I work FOR the company.
Here are examples of the same idea using by and for:
I did the work FOR you, but the work was done BY me, and I sent it BY email to our boss.
I'm preparing FOR the party. All the preparations were done BY me.
Here's one unusual example where you're talking about a deadline, and you can use either by or for:
Peterson, I want that report by Tuesday!
Peterson, I want that report for Tuesday!
In this case both by and for mean he wants the report finished Tuesday or before. "By Tuesday" is more common than "For Tuesday".