HTML And DBmail
Nov 29, 2007Is anyone using a SP or Trigger to Create a HTML formated e-mail and send it useing DBmail?
If so could I see a sample of the code?
Jim
Users <> Logic
Is anyone using a SP or Trigger to Create a HTML formated e-mail and send it useing DBmail?
If so could I see a sample of the code?
Jim
Users <> Logic
When sending an email in HTML format, shouldn't this allow for 2gb of data? Mine is getting truncated after 4000 characters.
@body NVARCHAR(MAX) = NULL,
EXEC msdb.dbo.sp_send_dbmail
@recipients='someone@some.com',
@reply_to='someone'
@from_address='someone@here.com>',
@profile_name = 'profilename',
@body_format = 'HTML',
@body = 'lots of data'
I am retrieving a field from SQL and displaying that data on a web page.
The data contains a mixture of text and html codes, like this "<b>test</b>".
But rather than displaying the word test in bold, it is displaying the entire sting as text.
How do I get it to treat the HTML as HTML?
Is it possible to embed a image datatype into a EMail message using sp_Send_DBMail?
For example, my query would select a saved print screen image held in a SQL table as datatype image. I would prefer not to attach this image but rather have it print in the message section.
Thanks in advance.
Hi,
I am using SQL Server 2005 and need to mail. I used sp_send_dbmail for mailing but I am able send to one @recipeint and one @copy_recipient.
How can I mail to many email addresses and/or group?
Any help is appreciated.
Thank you,
With Query Anylyser, I am sending mails with DBMail successfully. Each time mail is sent, bottom half window messages tab shows
"Mail (Id: 30242) queued."
Is there any way to capture Mail (Id: 30242) and update the same in a table?
I have a stored proc that inserts records into a table, gets the identity, and uses that identity on a .net webpage. The page retrieves that identity key and processes some stuff on the page.
Everything was working fine until I tried to enable sql mail with triggers. I wanted to double-check some stuff, so I requested an sql email be sent whenever an insert occurs on the table above. Here's what I think is happening --- please correct and/or help me out with a work around?
I use the stored proc to insert a record.
I select the @@identity.
The trigger fires but uses select to retrieve the latest insert - thereby replacing the @@identity number returned to the page?
If this is true, could I do something like the following in the original stored proc? Is this a good idea or bad idea?
BEGIN
Declare @myID as int, @myBody1 as varChar(200)
Set @myID=0
INSERT INTO table (fields) VALUES (@PID, more stuff);
Set @myID = SELECT @@IDENTITY As [Identity];
If @myID<>0
Begin
Set @body1='<br />pid=' + more stuff.....
Exec msdb.dbo.sp_send_dbmail
@profile_name='profileName',
@recipients='email@email.com',
@subject='Temp History Insert',
@body=@body1,
@body_format= 'HTML' ;
End
END
Hi,
I'd like to have some feedback from the experts on SQL 2005.
The situations is the following.
I have an application .net/SQL server 2000 that send notification mails using the SQL mail feature. It works fine for years.
Sooner or later SQL 2000 will be out of service, so I decide to move my database to SQL 2005.
When I'm trying to put in production with my web hosting provider www.webhost4life.com, they said that are not supporting SQL DBMAIL on any SQL 2005 32/64 bits because the extra workload will slow down SQL 2005 performance.
My question is if somebody has experience of this situation in other installations or maybe is that provider who has some problems tuning the SQL servers.
We are having trouble configuring SQL Server 2005 to use MX records.
Basically, we want to use DBmail to utilize multiple mail relays.
The three mail relays are contained within internal DNS MX records.
smtphost.xxx.com. IN MX 10 mailhost1.xxx.com.
smtphost.xxx.com. IN MX 10 mailhost2.xxx.com.
smtphost.xxx.com. IN MX 10 mailhost3.xxx.com.
It doesn't seem to like using MX records? Any ideas?
Thanks KraftR
Tim.Kraft@Dowjones.com
I am using DBMail to send an email notification at the completion of service broker process and have been getting the following security error:
Msg 229, Level 14, State 5, Procedure sp_send_dbmail, Line 1
EXECUTE permission denied on object 'sp_send_dbmail', database 'msdb', schema 'dbo'.
I have given the userID used to run the Service Broker, databasemailuserrole in msdb as per instruction in the msdb. I have also given it execute permission on the sp_send_dbmail but keep getting the error. The service broker is run using a sql login and the dbmail profile is set as public profile. Any suggestions would be much appreciated.
Can a regular user configure DBMail on a SQL 2005 Server?
Thanks
I have a stored proc that inserts records into a table, gets the identity, and uses that identity on a .net webpage. The page retrieves that identity key and processes some stuff on the page.
Everything was working fine until I tried to enable sql mail with triggers. I wanted to double-check some stuff, so I requested an sql email be sent whenever an insert occurs on the table above. Here's what I think is happening --- please correct and/or help me out with a work around?
I use the stored proc to insert a record.
I select the @@identity.
The trigger fires but uses select to retrieve the latest insert - thereby replacing the @@identity number returned to the page?
If this is true, could I do something like the following in the original stored proc? Is this a good idea or bad idea?
BEGIN
Declare @myID as int, @myBody1 as varChar(200)
Set @myID=0
INSERT INTO table (fields) VALUES (@PID, more stuff);
Set @myID = SELECT @@IDENTITY As [Identity];
If @myID<>0
Begin
Set @body1='<br />pid=' + more stuff.....
Exec msdb.dbo.sp_send_dbmail
@profile_name='profileName',
@recipients='email@email.com',
@subject='Temp History Insert',
@body=@body1,
@body_format= 'HTML' ;
End
END
Hi!
I try to use Service Broker and DBMail together, but have some trouble with that.
I need to create the queue with activation.
And the stored procedure activated on this queue must send e-mail using DBmail.
It's looks simple, but it doesn't work.
There is my script to create objects, but don't forget create dbmail profile before use it.
PS And replace my email by yours
Good morning,
I'm stumped on this trigger error and I'm hoping someone can help. Here's the background:
BACKGROUND
Running SQLServer2005 on WinServer 2003 RC2. We use a SQL-based business application that has it's own alert system that uses database mail sucessfully, meaning the built-in emailing functions of the application work and can communicate with the database mail profile and send mail without error.
PROBLEM
I'm trying to write a trigger that will automatically send out an email alert after certain actions are performed in the business application. When I enable the trigger and it tries to run it fails with the following error:
SQLDBCode: 229Alerts error: SQLSTATE = 4200Microsoft OLE DB Provider for SQL ServerEXECUTE permission denied on object 'sp_send_dbmail', database 'msdb', schema 'dbo'...
TROUBLESHOOTING
I've seen several articles about DatabaseMailUserRole permissions and have made sure that all users, admin and even guest (for testing) are members of this role. Other than that our setup is pretty vanilla so I'm not sure what else to do.
We only have one large dbase for the app and the fact that the internal emailing fuction works makes me think that the permissions for the msdb are already correct (although I could be wrong)
This problem is driving me crazy so I thank you in advance for any suggestions!
I would like to replace mymail@mail.com by mypdl@mail.com , where mypdl is basically a people distribution list with 2 emails: my own email and my coworker and fellow DBA.
IF EXISTS
(
SELECT TOP 1 [PercentUsed]
FROM [BackupSize]
WHERE PercentUsed>=70 AND [drivename]='D:' -- D is the internal drive
ORDER BY [MetricDate] DESC
[Code] ...
But I think this won't work by design. Maybe I need to create an operator?
I am attempting to use dbmail from an application that logs in to my database using an application role. Since the application role does not exist outside the database, I created an spSendEmail in the database with "execute as login='mailagent'" in it: I set the database to trustworthy, created a 'mailagent' account and added it to the msdb database with the databasemailuser role rights.
Email works just fine on the server when I use the execute as login='mailagent' to fire off the msdb..sp_send_dbmail. But from the .NET application, I get the error: "Cannot execute as the server principal because the principal 'mailagent' does not exist, this type of principal cannot be impersonated, or you do not have permission." When I run my spSendEmail stored procedure from the calling database, I get the same error.
If I use msdb..sp_send_dbmail or save query results as text (using sqlcmd) and include the column headers I get the dashed separator line.
e.g.
custID, name
------, ------
1,bob
2,jamesI would like this
custID, name
1, bob
2 ,james
I found this method [URL] ....
::
sqlcmd -E -S (local) -d myDB -W -w 1024 -s "," -i "SELECT * FROM tblCust" | findstr /V /C:- /B > C: emp.csv
Can the same result be achieved sending as attachment with dbmail?
EXEC msdb..sp_send_dbmail @attach_query_result_as_file = 1I don't want to have to add column names as part of the query
Change the query to return column headers in resultset
SELECT 'CustID' as f1, 'name' as f2
UNION ALL
SELECT CAST(CustID as Varchar(10)), name FROM tblCustand set
msdb..sp_send_dbmail @query_result_header = 0
Under IIS SMTP I can set bounced email redirect etc. how to do that with dbmail, the idea is I can get the list of bounced emails somewhere so I can create a report.
Any idea?
thanks
Hi.
I've got a question regarding record inserts via a from (textbox, multiple lines) on a web page.
I'm using a textbox within a form to enter data for a record. When this box contains several lines and the data is inserted into the database (SQL2005 Ent.) it separates each line with a character similar to a square (probably a line break symbol or something). This is all fine for storage, but retrieving the data and displaying it on a web page, just displays one long line, not at all how I entered it in my textbox.
Is there a way to "replace" all of the line breaks with.. say.. "<br>", so that it displays more correctly? Or perhaps I need to implement a HTML-based editor on my form (I've seen them out there, but should this really be necessary?).
I'm using ASP.NET (*.asp pages) and VBScript..
Not sure if this is the right forum for this, so please move if necessary.
Best regards,
Egil
I heard there is a way to publish the results of SQL 7 jobs to HTML files.
has anyone tried this
I would like to know if someone has any idea on how to make a "<select></select>" tag hidden. for a textbox it's simply:
<input type="hidden" id="textCustom2" name="textCustom2" value>.
Is there such a thing for options? a javascript perharps?
thanks.
Hi
I am very new to sql...
I want to export the results of this query
select count(*) from mail where Completed='c'
to an html file.
Can this be done?
Thanks
Terence
So I have a stored procedure that returns rows that look similer to this
Code:
<a href="~/Manage/ManageVersion.aspx?viewstate=MTgwNywzMTc0LDguOSAgICAgICA=">DPF-13</a>
Unfortunatly when it is bound to the gridview it seems to convert the value to HTML safe.
The value it prints on the page is
Code:
<a href="~/Manage/ManageVersion.aspx?viewstate=MTgwNywzMTc0LDguOSAgICAgICA=">DPF-13</a>
Hit quote to look at the actual values
How can I fix the output to the gridview to print the actual link and the the html safe value?
Can I accomplish this in SQL or am I going to have to do it all in the c# code (which will be a less clean solution and alot more work).
tia
hello,
Im not really sure if this is the right thing to do. But i want to save a copy of the html from my invoice to sql so that i can keep a history of the invoices in case their are changes done to them. Anybody know what would be the best way to do this?
Thank you,
~ Mauricio
http://www.testyourabilities.com/it/IT tests. SQL, XML, ASP.NET, C, C++, C#, VB.NET, HTML...
View 2 Replies View RelatedHi!I want to write a function or stored procedure such that it will useADO2.6 or better so I can use the XMLhttpServer.When this function is invoked it will execute a URL and gather thehtml code and store it in the Db.So one thought would be how can I write a Stored Proc or function inSQL to instantiate a DLL and use it? In this case I want to use ADOdll and use the xmlhttp functions. I pass some parameters to this dlland it will return data and the SP will store the results in the DB.Thanks
View 1 Replies View Related
Hello, If HTML is written as textbox value, this one is not interpreted in viewer as HTML but in text (tags displayed). Is it possible to apply HTML style (bold, underline...) in a same zone please ?
I have a report which uses for one of its columns, a text field that contains HTML formatting. FreeTextBox is used to enter the rich-text data and is bound to a dataset, in this type of format : <BR><B>the title</B><P>Some stuff...</P>. Needless to say, when this prints out it does not look very useful. Is there any way to embed a rich-text type field in a report?
View 1 Replies View RelatedHi,
Does anyone know if it's possible to read data from an HTML page using SSIS.
Thanks
I have a report which is in html format. I need to import this html into SQL. I am using DTS package to dump the table to a SQL server table.
The data in the html table is in the format
<tr> <td xtr="Other"> Other </td> <td x:num="1234.5678"> 1.234 </td></tr>
I need the data in <td x:num="1234.5678"> to be inserted into the table instead of the value between the <td> </td> tags.
The value in my SQL table should be "1234.5678" instead of "1.234"
How do I extract the data from <td x:num="1234.5678"> ?
Any help would be appreciated.
Hi
I am developing a project in asp.net. And i need to store html content in sql server.
Will anybody tell me which datatype should be used for storing html tags in sql server.
for example i want to store <a href="abc.asp">abc.asp</a> in database.
and when I retrive it back from database it should be real html tag and not string.
Thanks
Main goal is to parse an Excel Worksheet and save it as a HTML table to SQL.
I have a web form (aspx) where a use is able to browse and upload an excel documnt. I then select the data from the worksheet and use a OleDBDataAdapter to build a Dataset from the Excel data. I fill the dataset with the data from the Excel document.
What I need to do from this point has me lost. I need to re-engineer the excel data into a HTML table to display within a orgianl asp code. I was planning to build the html table...save it as a large string to SQL database table. And then from asp page - read the table and re-display it.
Im not sure how to do this...anyone with experinece, please help.
Other things I have tried. After I have the excel data saved in the dataset...I can read it via Readxml and display it within the asp.net code. So, I dont knwo if it is possible to save this dataset information as HTML to a string...?
Hi y'all I want my written text in an textarea store in a sql database. Which format do i have to choose so sql server understands <br>. Now i use ntext and i get a scrambled <br> (2 cubes)Thanks in advance.Grtz
View 4 Replies View Related