Hi:
As you have discovered, TAGSETS.EXCELXP is the ODS destination which creates Spreadsheet Markup Language XML. This type of markup language is indeed an ASCII text file, which conforms to the Office 2003 specification for XML which describes a spreadsheet.
TAGSETS.EXCELXP does not create a true, binary Excel file. When you create a file with this destination and you use a file extension of ".xls", you are merely "fooling" the Windows registry into launching Excel when you double click on the file. Using the .XLS extension does not automatically make the file a true, binary Excel file. The snippet of XML that you posted is the XML processing instruction and the beginning <Workbook> tag that is part of every TAGSETS.EXCELXP file.
There are many previous forum postings on emailing files and emailing attachments. If the people you are sending the file to have Office 2003 or higher, then Excel should open the XML file correctly. If they only have Office 2000 or Office 97, then Excel will not open and render the XML correctly. I'm not sure, exactly, what's happening...it sounds like your mail server recognizes that the attachment is an XML file. Some mail servers will not send XML or HTML files, so perhaps something like this is involved.
You might want to search on support.sas.com for more help with emailing or open a track with Tech Support for more help. When I run this code on my Windows system, the files (HTML and XML) are correctly sent using Microsoft Outlook. When I receive them, I can save them both to disk.
Also, did you know that HTML files created with ODS can be opened in a browser and can be opened with Excel?? Ever since Office 97, Microsoft Office has been able to open and render HTML files. I know that TAGSETS.EXCELXP gives you some suboptions that control things like FITTOPAGE, and ORIENTATION, etc, however, you are essentially sending two "markup language" copies of the same file -- one HTML Markup Language and the other an Office 2003 Spreadsheet Markup Language file.
cynthia
[pre]
ods tagsets.excelxp file='c:\temp\table_xp.xls' style=printer;
ods html file='c:\temp\table_ht.html' style=sasweb;
proc print data=sashelp.class;
run;
ods _all_ close;
filename doemail email to='username@something.com'
from='other.user@something.com'
subject='Testing attach of multiple files'
attach=('c:\temp\table_xp.xls' 'c:\temp\table_ht.html');
data _null_;
file doemail;
put 'this is a test with several attachments.';
put 'one file is an HTML version of SASHELP.CLASS';
put 'the other file is an XML version of SASHELP.CLASS that you should';
put 'be able to open with Excel 2003 or higher.';
run;
[/pre]