2002 Honda Civic LX - Ripped off passenger side power mirror?

It won't pass inspection because of it, and the guy at the garage said it would cost $170.00 to fix! I wanted to try plugging the wires back in first. (see pics). Nothing else is broken. The wires are color-coded. The ones on the mirror are pink, orange and brown. The ones in the door part are white w/red stripe, red w/yellow stripe and green w/white stripe. Does anyone know if this might be fixable? How do I plug these back in? Any info/ideas would be greatly appreciated.

Mirror picture: 2002 Honda Civic LX - Ripped off passenger side power mirror
Door picture: 2002 Honda Civic LX - Ripped off passenger side power mirror - 1

1st of all, I will presume that the inspection you refer to is for your State that is required annually or whenever, correct? If so, then whoever gave you the info that the passenger mirror needs to be on the vehicle is not correct ( at least not in California, and probably other States as well ) ! The reason I point this out is that not all vehicles are equipped with an outside passenger mirror, therefore, if the other vehicles w/o the mirror pass inspection, then your vehicle should also ( look at the laws for where you live )

now as for the mirror - you can purchase a replacement mirror with the housing for far less then that garage stated, but it will not be in the same color as the vehicle; you could have a body shop paint it, but the paint would not match 100 % because of the age of the paint on the vehicle now

I've reattached many mirrors by just screwing larger machine screws into the mirror where the studs have torn out of the mirror. You may have to drill the holes in the door larger first. Go to the dealer and see if they will print you a wiring connector photo that shows in which position each wire goes. I guess you could try plugging the wires into the connector and try out the mirror to see if it moves in the right direction with the switch movements but that will take some experimenting. You may need to just mount the mirror and manually set it's position.