Calculated vs Rated Currents in Designing Transistor Switch Circuits
OK, your relay coil is a very thin long wire having 720 ohms resistance. When the switching transistor is ON, 16.7 mA current flows through the coil, then through this saturated transistor, and back to the 12v supply. So Ic=16.7mA
This is where we start.

On some 2N2222 data sheets, a graph of Vce(sat) vs. Ic is shown. On most of these type graphs, base current is set to one-tenth of Ic. Although the transistor has much higher current gain (perhaps 200), the base is over-driven to ensure that the transistor switch is unambiguously ON. If you follow this rule-of-ten, then you want to design base current to be 1.67mA.

Let us suppose your microcontroller runs from a +5v supply so that the value of R1 (base resistor) can be found. With logic 1 pulling one end of this resistor nearly to +5v, base voltage of Q1 will be about +0.65v. This leaves the remaining 4.35 v across R1. So R1 = 4.35/0.00167 ohms. That's 2605 ohms.
You can use the next higher standard value 2700 ohms, because the factor-of-ten overdrive is more than necessary. From your microcontroller output pin, only 1.67 mA. current will be drawn (not 40mA). When it is switched to logic 0, no current will be drawn.

Why provide more base current than necessary? Transistor current gain can vary a lot (a Fairchild data sheet suggests it can be as low as 75). The extra base current also forces Vce to a smaller value, ensuring that Q1 acts as a good switch.  Military or automotive designs are a bit more stringent where very wide temperature extremes must be accommodated.