Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Messaging

Author  Topic 

whitmoj
Yak Posting Veteran

68 Posts

Posted - 2009-02-16 : 06:01:10
Not sure if this is in the right forum but here goes I have set my final SP to send an email out when complete via xp_smtp_sendmail. I am aware that an sms can also be sent from a SP but have no idea on how to right it and if I need any other software. Can any one help or point me in the direction.



Whitmoj
If I have inspired one person today then my job is done.

sridhar.dbe
Starting Member

34 Posts

Posted - 2009-02-16 : 06:12:06
hi,
go through this link


http://www.sqlteam.com/article/sending-smtp-mail-using-a-stored-procedure
or

DECLARE @SenderAddress varchar(100)
DECLARE @RecipientAddress varchar(100)
DECLARE @Subject varchar(200)
DECLARE @Body varchar(8000)
DECLARE @oMail int --Object reference
DECLARE @resultcode int

SET @SenderAddress = 'someone@someisp.com'
SET @RecipientAddress= 'someone@someisp.net'
SELECT @Subject = 'subject of email for today ' + CAST(getdate() AS
varchar(12))
SET @Body = 'This is the body of my email'

EXEC @resultcode = sp_OACreate 'CDONTS.NewMail', @oMail OUT
IF @resultcode = 0
BEGIN
EXEC @resultcode = sp_OASetProperty @oMail, 'BodyFormat', 0
EXEC @resultcode = sp_OASetProperty @oMail, 'MailFormat', 0
EXEC @resultcode = sp_OASetProperty @oMail, 'Importance', 1
EXEC @resultcode = sp_OASetProperty @oMail, 'From',
@SenderAddress
EXEC @resultcode = sp_OASetProperty @oMail, 'To',
@RecipientAddress
EXEC @resultcode = sp_OASetProperty @oMail, 'Subject',
@Subject
EXEC @resultcode = sp_OASetProperty @oMail, 'Body', @Body
EXEC @resultcode = sp_OAMethod @oMail, 'Send', NULL
EXEC sp_OADestroy @oMail
END
Go to Top of Page

whitmoj
Yak Posting Veteran

68 Posts

Posted - 2009-02-16 : 06:42:41
I dont think I made myself clear I have got the email working fine I just want to add SMS messaging after

Whitmoj
If I have inspired one person today then my job is done.
Go to Top of Page

hjh321
Starting Member

3 Posts

Posted - 2010-09-20 : 10:02:19
spam removed
Go to Top of Page
   

- Advertisement -