ZnO:Al and Zn1-xMgxO:Al films have been deposited by magnetron sputtering from ceramic targets at substrate temperatures from room temperature to 500 °C. We studied the relation between the electronic transport and the structural properties as a function of the deposition temperature. Films with the lowest resistivity (7·10−4 Ω cm for ZnO:Al and 3.6·10−3 Ω cm for Zn1-xMgxO:Al) can be prepared for deposition temperatures around 300 °C. This optimum is accompanied by the highest carrier concentration and the highest Hall mobility. Changes in crystalline quality and free carrier concentration are explained as a result of a bombardment of the films by high energetic negative oxygen ions during growth and by phase segregation for higher deposition temperatures. The dependence of the Hall mobility on the carrier concentration can be explained by grain barrier scattering for n <≈ 5·1020 cm−3 and by ionized impurity scattering for n >≈ 5·1020 cm−3. From the fit of the μ(n) dependence for both materials a trap density at grain boundaries of Nt ≈ 2.3·1013 cm−2 was determined.