Webmaster Help
|
Welcome, Guest. Please login or register.
Did you miss your activation email?
Jan 05, 2009, 10:09:42 PM

Login with username, password and session length

Children have never been very good at listening to their elders, but they have never failed to imitate them.


- James Baldwin

Welcome Guest - Register or Login Now to remove these advertisments


Registration is completely free and only takes a few minutes to signup !

|-   Entrepreneur Forum > Webmasters - Discuss Making Money Online > Website Design and Maintenance > Database
+   Sending email from a Stored Procedure in MS SQL Server
0 Members and 1 Guest are viewing this topic.
Pages: [1] Reply to Thread
Author Topic: Sending email from a Stored Procedure in MS SQL Server  (Read 218 times)
Online~Dave~
Administrator
~Dave~ is a jewel in the rough~Dave~ is a jewel in the rough~Dave~ is a jewel in the rough~Dave~ is a jewel in the rough
Joined: Jan 2006
Posts: 6186


Avatar of code4gol

Building a Foundation

View ~Dave~\s ProfileWWW
Gender: MaleGemini United States
notepad 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 ===============================================

Latest Blog Post : Social Media Optimization for Social Media Marketing

Pages: [1] Reply to Thread


Code4Gold Affiliate Entrepreneur Moneymaker Forum © 2006-2008 Resdaz Media LLC - All Rights Reserved

Forum Software Powered by SMF - © 2001-2008, Lewis Media. All Rights Reserved.