    Joined: Jan 2006 Posts: 6186
Building a Foundation
 
 United States
|
Nov 09, 2007, 11:03:14 PM | #1 |
The best way to do this if you want to support any type of attachments or message data longer than 255 characters is to install XPSMTP (an extended stored procedure) into your sQLServer instead of using the provided xp_sendmail procedure. Documentation is available at... http://sqldev.net/xp/xpsmtp.htm
An example of using XPSMTP from a stored procedure
============== cut here ===============================================
declare @results VARCHAR(8000) Set @results = '' select @results = @results + City + '\n\r' FROM ZIPCodes WHERE StateCode = 'FL'
declare @rc int exec @rc = master.dbo.xp_smtp_sendmail @FROM = N'me@sender.com', @TO = N'me@mydomain.com', @subject = N'Hello SQL Server SMTP Mail', @server = N'mail.sender.com', @message = @results
select RC = @rc GO
============== cut here =============================================== |
|