Extended sql-based mail commands