I am trying to setup an auto response email from SQL. I have a form that is setup on my CMS which notifies me when a new form has been submitted. The problem is all the emails are coming from a single email address so I can't setup a rule in outlook to auto respond to the user that submitted the form.
I would like to send this email from SQL for every new form that is submitted. I am testing the emails with the code below. I don't know how to dynamically pull the email field from the database field (form_text_box_c0003) to send to each user that submitted the forms...
Any guidance would be much appreciated.
DECLARE @ServerAddr nvarchar(128)
Set @ServerAddr = 'smtp.emailarchitect.net'
DECLARE @From nvarchar(128)
Set @From = 'test@emailarchitect.net'
DECLARE @To nvarchar(1024)
/*You can input multiple recipients and use comma (,) to separate multiple addresses */
Set @To = 'support@emailarchitect.net'
DECLARE @Subject nvarchar(256)
Set @Subject = 'simple email from SQL server'
DECLARE @Bodytext nvarchar(512)
Set @BodyText = 'This is a test text email from MS SQL server, do not reply.'