USE [BUPADigitalLoyaltyCard]
GO
/****** Object: StoredProcedure [dbo].[prcSendEmail] Script Date: 10/23/2014 10:34:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:
-- ALTER date:
-- Description:
-- =============================================
ALTER PROCEDURE [dbo].[prcSendEmail]
@email varchar(100)
AS
BEGIN
DECLARE @SMSBodyText VARCHAR(50)
DECLARE @MySubject VARCHAR(50)
DECLARE @bodyText VARCHAR(MAX)
DECLARE @url VARCHAR(100)
DECLARE @formid VARCHAR(10)
Set @MySubject = 'BUPA Digital Loyalty Card - BUPA'
--SET @Email = 'Gary.Templeton@cpm-aus.com.au;'
SELECT top 1 @formid=formid FROM tblLoyaltyCardDetails ORDER BY newid()
SET @url = 'http://10.2.119.228/BupaDLC/BUPADigiLoyaltyCard/index?formid='+ @formid
print @url
Set @MySubject = 'Passkit URL - BUPA'
Set @bodyText = 'Hello
Click on the link below:
'+ @url + '
Regards,
BUPA'
IF @email IS NOT NULL
print @email
Begin
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'AGLCustomerCare',
@recipients = @email,
@blind_copy_recipients = 'reshma.karunakaran@cpm-aus.com.au',
@subject = @MySubject,
@body = @bodyText,
@body_format = 'HTML';
END
END