more advanced script for notification by email