improved email functionality; now works without user interaction