An indirect object is the person or thing that receives the direct object. It answers the question to whom? or for whom? the action is done.
Here a book is the direct object (the thing given) and Daniel is the indirect object (the person who receives it). An indirect object can only exist in a sentence that already has a direct object.
Two word orders
English gives you two ways to express the same idea. Both are correct.
Without a preposition
The indirect object sits between the verb and the direct object.
This order is the more natural choice in everyday speech, especially when the indirect object is short — a name or a pronoun.
With a preposition
The direct object comes first, followed by to or for and the indirect object.
The meaning does not change. The choice between the two orders depends on rhythm and emphasis, not grammar.
To or for
The preposition you use depends on the verb. There is no rule you can derive from the meaning — you need to know which verbs go with to and which go with for.
Verbs with *to*
These describe transferring something to a recipient: give, send, show, tell, offer, teach, lend, bring, hand, pass, write, read.
Verbs with *for*
These describe doing something for someone's benefit: buy, make, cook, find, get, save, build, order.
A few verbs, like bring, can work with either preposition depending on the meaning. He brought flowers to her (delivered) vs. He brought flowers for her (on her behalf, as a favour).
When you must use the preposition
In three situations, the short order (verb + IO + DO) sounds awkward or is considered wrong. Use to or for instead.
When the indirect object is long. A short direct object followed by a long phrase reads more naturally than the other way around.
Putting the student who had just arrived from Berlin between the verb and the keys would feel heavy and unbalanced.
When both objects are pronouns. Most speakers strongly prefer the preposition form here.
The alternative (Give me it, Sarah sent her them) exists in some dialects but sounds odd to most English speakers.
With the verb explain. This verb never takes the short order in standard English.
The professor explained the class the theory is a common mistake, but it is not accepted in any major dialect.
Pronouns as indirect objects
When the indirect object is a pronoun, use the object form: me, you, him, her, it, us, them.
This is the same set of object pronouns used for direct objects. If the subject and the indirect object are the same person, use a reflexive pronoun: He bought himself a new jacket.
Common mistakes
Wrong preposition
Using explain without a preposition
Wrong pronoun form
Both objects as pronouns without a preposition
Missing indirect object altogether