I am sure that I am missing an escape character, but I can't figure it out. Can someone help me out?
Thanks in advance,
Donald
Code:
CREATE PROC sp_SendConfirmationMail AS
BEGIN
SET NOCOUNT ON
DECLARE @em nvarchar(100), @order_id nvarchar(100),@rc int
DECLARE EmailCursor CURSOR
FOR SELECT 'leagueofnerds@hotmail.com'as EM,'102030'as order_id /*Create Select Statement Here*/
OPEN EmailCursor
FETCH NEXT FROM EmailCursor INTO @em,@order_id
WHILE @@Fetch_Status = 0 BEGIN
EXEC @rc = master.dbo.xp_smtp_sendmail
@FROM = N'customerservice@goorin.com',
@TO = @em,
@priority = N'NORMAL',
@subject = N'Your recent Goorin Order '@order_id N' is being processed.' ,
@message = N'Thank you for your recent order. We wanted to let you know that we value your business and are currently processing your order for shipment today.',
@type = N'html',
@server = N'mail.goorin.com'
SELECT Email = @em, RC = @rc
FETCH NEXT FROM YourCursor INTO @em
END
CLOSE EmailCursor
DEALLOCATE EmailCursur
END
Thanks in advance,
Donald