Create mail monitor code