sp-send-dbmail

sp_send_dbmail attachment encoding

I am using sp_send_dbmail in SQL2005 to send an email with the results in an attachment. When the attachment is sent it is UCS-2 Encoded, I want it to be ANSI or UTF-8. Here is the SQL EXEC msdb.dbo.sp_send_dbmail @recipients = '[email protected]' , @query = 'DECLARE @string_to_trim varchar(60);SET @string_to_trim = ''1234''; sel...

sp_send_dbmail & varbinary

I have some files stored in a SQL Server 2005 table in a varbinary(max) column. I need to email these files to users on a schedule, and though I can write a c# service to extract and send the email sp_send_dbmail would seem to be perfect for my purpose. The code I'm using looks like this: EXEC msdb.dbo.sp_send_dbmail @profile_name = 'SQ...

How to specify the reply-to address using sp_send_dbmail in SQL Server

I need to send an email to someone and want them to be able to simply reply to the email without having to specify the email address. Using sp_send_dbmail sets the reply-to address as the name of the profile that it was sent from. Can this be changed to specify the reply-to so it looks like it came from me. Thanks. ...

sp_send_dbmail will not send query results

I've tried every avenue on every damn forum suggested, but to no avail! Need to send results of SQLPERF(logspace), that have been stored in a table, via sp_send_dbmail to recipient. Step 2 of job is where failure occurs. Please help! EXEC msdb.dbo.sp_send_dbmail @profile_name= 'MyDBA', @recipients= '[email protected]', @subject='Log War...

Calling DBMAIL from CLR Stored Procedure

Is there a managed interface that can be used within a CLR Stored Procedure to send mail via the configured DBMAIL profiles? I am looking to send emails with attachments that will be downloaded from a web service so I am hoping to be able to send these without having to spool them out to disk in order to use the standard DBMAIL stored p...

DB Mail - No errors but email never received.

I am looking for either a solution to this problem or some ideas on how to debug. I have a website that calls a cobol executable. This occurs on the application server. The cobol exe connects to a database on another server using an ODBC connection. The cobol exe, after generating a report, deletes a row from a table in the database and...

specify content type of an attachment in sql server sp_send_dbmail

How can I specify the content type of an attachment when sending emails using sp_send_dbmail? The content type is specified as application/octet-stream for Zip, PDF files. But I need to change it to application/zip, application/pdf. The "file_attachments" parameter takes absolute paths of the attachments. Can not find a place to specify...

SQL Server 2005 sp_send_dbmail

Hi Friends, When we use sp_send_dbmail to send email with attachment, the attachment gets copied into a folder inside C:\Windows\Temp. As we have many emails to be sent every day, the temp folder grows rapidly. This is the case with SQL Server 2005. We noticed that, with SQL Server 2008, we dont see these file under temp folder. Is th...

send dbmail on @@error from sql server 2005

Hi, I am trying to send database mail when error occurs inside the transaction.My setup for dbo.sp_send_dbmail is correct , when I execute the proc I do get an email within 1 min. However when I try to use dbo.sp_send_dbmail inside another proc within transactions than I do not get the email. Sql server does show in the result window ...

How to send mail from Stored Procedure ?

Hi All, I need to send a mail from Stored Procedure. I knew it is possible. I studied it from this link . How do i authenticat in SMTP Server. Do you have any idea.? Thanks ...

How can I send plain text email (with line breaks) using sp_send_dbmail?

I have a SQL Server 2008 procedure that sends email via sp_send_dbmail. I'm using the following code: set @bodyText = ( select N'Here is one line of text ' + N'It would be nice to have this on a 2nd line ' + N'Below is some data: ' + N' ' + ...

SQL Server SP_SEND_DBMAIL Image file attachment.

I am using a trigger on a table to send an email using sp_send_dbmail. I want to include a file attachment in the email of an image type. The raw data for the jpeg is stored in the ndl_Image column which is of type binary. I have the following code:- DECLARE @ReferenceID varchar(max) DECLARE @Recipient varchar(Max) DECLARE @Body varc...

sp_send_dbmail inserts line-breaks into the attached xml query result

When you use msdb.dbo.sp_send_dbmail to send a query result as an attachment, you'll have to provide the @query_result_width parameter which is an integer between 10 and 32767. Now, If you use For XML Path('Row'), Root('Data'), Type in your most-outer Select query, you may get the send_dbmail to send an xml attachment for you which is re...