This is the code I wrote
proc export data=work.XYZ outfile="XYZ.xlsx" dbms=xlsx replace; run; filename outbox email from=\'abc@abc.com\' to