I hesitate to post this, because this subject seems to be a contentious issue, with many folks VERY adamant that what they do is the only right thing to do.
Personally, my advice seems to go against what many folks here subscribe to.
The original poster stated that they have a 40 gallon ELECTRIC hot water tank...so there is no pilot. He most likely has a Rheem tank with two elements.
I know people do it everyday...but personally, I do NOT like to have the water tank shut off for an extended time. This can in some instances, (and I have seen it) cause a biofilm growth.
Read this article----
Access Denied
You can still click on the article, it will come up.
I think the best way to leave for an extended time is to leave the water tank on. Have someone check on the house once a week. They should turn on the main water valve, run faucets, flush toilets, etc. They could then when they leave turn off the main valve, then turn it back on when they return a week later.
Do you really want to leave 40 gallons stagnant in a tank installed in a hot garage for months, then come back to that water? If the water is not being used, as the home is vacant, how much really does it cost to keep that water only a few degrees hotter than the garage is anyway? The tank is insulated.
The other more contentious issue would be the temperature setting. The Villages sets the tank temperature at around 120 degrees, for fear of scalding. I personally feel more comfortable having the temperature a bit hotter to kill bacteria.....but that is just me.
I actually have a friend who leaves his home for months at a time. I go over there the day before to run all the stinky water out of his tank before he gets here...the whole house then smells from a rotten egg smell, most likely caused by the interaction of his stagnant water with the Anode in his tank.
Just some other rules of thumb here.....
Never drain your tank without turning off the double pole breaker for the tank. The elements are made to stay full immersed in water. If exposed to air and on, they will almost instantly burn out.
Turning off the main valve should not risk emptying your tank. The only way that could happen is if a faucet was turned on LOWER than your tank...(almost impossible here with no basements).
I know my opinion is in the minority here.....just my two cents and it did not cost anything....Enjoy!
Frank D.