Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trigger and xp_sendmail function

Status
Not open for further replies.

cjohnson6

Technical User
Jul 19, 2000
21
0
0
US
The syntax I've created below is a trigger I'm trying to execute that will send and email to a potential candidate when certain info is input by that candidate.<br>If you look at the &quot;exec&quot; statement below, is there a way you can use an actual field name (in this case I want to use the candidate's email address) within the 'exec' statement?<br>As the syntax below stands, the XP_sendmail function is execute, but the field name I've designated (@send_candemail) and its text are not showing up in the body of my email message.&nbsp;&nbsp;It justs shows as blank.<br><br>Can anyone tell me why this might be happening or if my syntax is incorrect?<br><br>Any assistance would be appreciated.<br>Thanks,<br>Claude<br><br><br><br><br>CREATE TRIGGER [Trig_VerifyPassword] ON [t_candidate1]<br>FOR INSERT, UPDATE, DELETE<br>AS<br><br>Declare @verified_password&nbsp;&nbsp;smallint,<br> @sendmessage&nbsp;&nbsp;varchar (200),<br> @send_candidate&nbsp;&nbsp;varchar (100),<br> @send_fname&nbsp;&nbsp;varchar (50),<br> @send_lname&nbsp;&nbsp;varchar (50),<br> @cand_email varchar (50),<br> @sendcand_email&nbsp;&nbsp;varchar (50)<br><br>SELECT @verified_password = B.verified_password, @cand_email = B.email <br>FROM t_candidate1 B, INSERTED I<br>WHERE I.candidate_id = B.candidate_id and @verified_password = '1'<br><br>--send email with link so that candidate can verify password<br>select @send_candidate = @send_fname + @send_lname<br>select @sendcand_email = @cand_email<br>select @sendmessage = 'Please initiate the following link so that your new password can be verified: '&nbsp;&nbsp;+&nbsp;&nbsp;' <A HREF=" TARGET="_new"> master.dbo.xp_sendmail @recipients =&nbsp;&nbsp;@sendcand_email, @copy_recipients = '<A HREF="mailto:cjohnson@staffmentor.net">cjohnson@staffmentor.net</A>',<br>@message = @sendmessage, @subject = 'Candidate Password Verification'<br><br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top