Hmmmm.
Couple of options, I think. Not very authentic, but you could make a weapon for a planet (visible or not...) that shoots extremely slow moving, extremely long lasting ammo. If you want mines in specific places, you can make spobs with the 'deadly' bit set, and an appropriate graphic. That is, obviously, deadly. The advantage being you have complete control over placement.
Hmmmm.
As for making a ship mine, I cant think of a good way to make it blow up (assuming you want something non-deadly, and the 'AI wont kill itself' is true). You can always make short range turreted black beam weapons with a dude that always attacks player. That likely triggers the alarm thing, which isnt optimal either. All told, nothing strikes me as obvious, but I'm sure some other people have better methods.