c4 with error handling and mail facility (drafted version)