It appears the plug is keyed so it only goes in one way. The wire from the plug is 'probably' red (12V +) and black (ground). If you don't have the plug you should probably contact the mirror manufacturer to see if you can get one.
The other option is to open the mirror and trace the contacts. It might be obvious from looking at the circuit board which pin connects to 12V +.
If that's a Toyota mirror (it doesn't look like mine or I'd just unplug it and let you know which is the hot pin) find out what year/model it's from and someone might have the wiring schematic for the car that'll help.
Cheers