You cannot on structures that are in hull timer or are not fully anchored because they were not cored. For those structures, the Cargo Deposit is not available. And even if you managed to get the package into such a structure, you still cannot deliver the contract because the contract service is not online due to the hull reinforcement/level.
Another thing about structure scams are “legit” pickups where they remove your docking right after you undock and then gank you on the undock with Taloses and insta tackle.
Taking contracts with structure destinations is not worth it in most cases. If you want to be a bit safer from scams, join the Haulers Channel and use their list of obvious scam structures and scam corps to block all issuers who setup contracts to and from such structures.