February 21, 2006 at 8:11 am
First of all, I am extreemly new at SQL. I have a small file that I manually send to a company on a daily basis. I would love it if sql could open up our mapi compliant Groupwise e-mail, attach the file and send it automatically to the company. Is this possible?
February 21, 2006 at 9:18 am
I use xp_sendmail all the time to send emails and results. I've never attached a file other than a result set, but looking in BOL, it appears that you can.
xp_sendmail {[@recipients =] 'recipients [;...n]'}
[,[@message =] 'message']
[,[@query =] 'query']
[,[@attachments =] 'attachments [;...n]']
[,[@copy_recipients =] 'copy_recipients [;...n]'
[,[@blind_copy_recipients =] 'blind_copy_recipients [;...n]'
[,[@subject =] 'subject']
[,[@type =] 'type']
[,[@attach_results =] 'attach_value']
[,[@no_output =] 'output_value']
[,[@no_header =] 'header_value']
[,[@width =] width]
[,[@separator =] 'separator']
[,[@echo_error =] 'echo_value']
[,[@set_user =] 'user']
[,[@dbuse =] 'database']
February 21, 2006 at 9:26 am
The file is the result of a simple query that needs to be e-mailed.
February 21, 2006 at 9:47 am
Try this. You'll obviously have to change the values.
exec master.dbo.xp_sendmail
@recipients='email@address.com',
@subject='Here are my results',
@attachments = 'Filename.txt',
@query='Select * from table where blahblahblah',
@attach_results = 'TRUE'
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply