Passing details after initial contact with the air traffic unit responsible for the Class D is sufficient.
For example, to transit Bournemouth Class D, you would call Bournemouth radar or approach or whatever they like to be called, and request zone transit. They'll come back and ask you to pass your msg, and once passed they will probably issue a clearance eg. "G-WXYZ is cleard to transit Bournemouth zone, not above 2000' QNH blah blah and the rest". Now you're cleared through within the limits of your clearance. Of course they can always tell you to remain clear of the class D....
Cheers
EA