SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 setting body_format in SP_SEND_DBMAIL
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Eyespi20
Starting Member

USA
10 Posts

Posted - 05/21/2012 :  15:33:14  Show Profile  Reply with Quote
I have a trigger that fires based on customers to send them information. Some of my customers can receive HTML formatted email and some cannot. When I can, I like to send "pretty" emails with our company logo, etc, but for those customers who cannot receive HTML emails, I want to send them plain text emails. I've coded my trigger to separate these customers out and have a parameter @bf where I set the body format to 'TEXT' or 'HTML' as appropriate, however when I try to set the @Body_Format parameter in the sp_send_dbmail, it makes the HTML text regardless. I've checked the parameter and it does return HTML and TEXT for the appropriate customer, but the stored procedure simply ignores the parameter and sends everything plain text.

Can you not set this to a variable? I seem to be able to set all the other settings to a parameter successfully.


Margaret
    è¿é

Eyespi20
Starting Member

USA
10 Posts

Posted - 05/21/2012 :  16:05:22  Show Profile  Reply with Quote
What I have ended up doing is adding an

IF @bf='HTML'
BEGIN

exec sp_send_DbMail
@body_format='HTML' etc etc

END

IF @bf='TEXT'
BEGIN

exec sp_send_DBMAIL
@body_format='TEXT', etc etc
END


to the trigger which is working a treat.

Still would like to know why @body_Format won't accept a parameter value though. It just seems strange to me.

Margaret
    è¿é
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000