| John Frank 2006-11-28, 7:23 pm |
|
> Hi,
> I want to use sp_send_dbmail to send an e-mail message in HTML format that
> has a list of names with corresponding email-adresses.
>
> I'd like to format the email-adress in the message text by mailto: tag so
> that the user can click on the email-adress to compose a new mail to the
> adress.
> What is the correct html format that I have to apply to the SQL statement to
> accomplish this?
>
> Heres the sample code from SQL Server 2005 BOL that I try to modify but
> didn't work as expected:
>
> DECLARE @tableHTML NVARCHAR(MAX) ;
>
> SET @tableHTML =
> N'<H1>eMail Reference</H1>' +
> N'<table border="1">' +
> N'<tr><th>Name</th><th>e-Mail</th>' +
> CAST ( ( SELECT td = AG.Name, '',
> td = '<a href="mailto:' +
> IsNull(AG.EMAIL_GESCHAEFT,'') + '">' + IsNull(AG.EMAIL_GESCHAEFT,'') + '</a>'
> FROM AG
> FOR XML PATH('tr'), TYPE ) AS NVARCHAR(MAX) ) +
> N'</table>' ;
>
> EXEC msdb.dbo.sp_send_dbmail @recipients='danw@Ad
venture-Works.com',
> @subject = 'eMail Reference',
> @body = @tableHTML,
> @body_format = 'HTML' ;
>
> When I run the code above this is the result that I get:
>
> Name e-Mail
> ------- -----------
> Ahrens <a href=" mailto:somename@doma
in.com">somename@domain.com</a>
>
>
>
> --
> Thanks in advance
> Bodo
I have the same problem.
BizTalk Utilities - Frustration free BizTalk Adapters
http://www.topxml.com/biztalkutilities
|