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.
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. WhitmojIf 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 linkhttp://www.sqlteam.com/article/sending-smtp-mail-using-a-stored-procedureorDECLARE @SenderAddress varchar(100)DECLARE @RecipientAddress varchar(100)DECLARE @Subject varchar(200)DECLARE @Body varchar(8000)DECLARE @oMail int --Object referenceDECLARE @resultcode intSET @SenderAddress = 'someone@someisp.com'SET @RecipientAddress= 'someone@someisp.net'SELECT @Subject = 'subject of email for today ' + CAST(getdate() ASvarchar(12))SET @Body = 'This is the body of my email'EXEC @resultcode = sp_OACreate 'CDONTS.NewMail', @oMail OUTIF @resultcode = 0BEGIN 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 @oMailEND |
|
|
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 afterWhitmojIf I have inspired one person today then my job is done. |
|
|
hjh321
Starting Member
3 Posts |
Posted - 2010-09-20 : 10:02:19
|
spam removed |
|
|
|
|
|
|
|