Wrapping the mail generation in a rolled-back transaction to prevent database changes from persisting during the former