Whenever it is safe to do so, should a caster run into melee range to execute an auto attack?

If it's safe to be in melee range, aren't you maximizing your damage as a caster by doing both your spells and auto attacks?