vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I would like to send the contents of a file using xp_sendmail however I do not want the file contents to be an attachment. I have no problem sending the file as an attachement. Can anybody give me an xp_sendmail example of how to do this. The results of a query can easily appear in the body of the email but all my attempts to include the contents of a file in the body of the email have not worked. TIA |
| ||||
| "Michael McGarrigle" <mjm@barwonwater.vic.gov.au> wrote in message news:9d0cafdc.0502171938.6007ef9a@posting.google.c om... >I would like to send the contents of a file using xp_sendmail however > I do not want the file contents to be an attachment. > I have no problem sending the file as an attachement. > Can anybody give me an xp_sendmail example of how to do this. > The results of a query can easily appear in the body of the email but > all my > attempts to include the contents of a file in the body of the email > have not worked. > > TIA Rather than use xp_sendmail, you could check out xp_smtp_sendmail: http://www.sqldev.net/xp/xpsmtp.htm It has a @messagefile parameter which looks like it may do what you want. Otherwise, you can use xp_cmdshell to read the file into a table, then query the table to get the message body: create table ##t (col1 varchar(1000)) insert into ##t exec master..xp_cmdshell 'type c:\myfile.txt' exec master..xp_sendmail @recipients = 'someone@somewhere.com', @query = 'select col1 from ##t' ... This is quite similar to example E for xp_sendmail in Books Online. Simon |
| Thread Tools | |
| Display Modes | |
|
|