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!

using xp_send function within a trigger

Status
Not open for further replies.

cjohnson6

Technical User
Jul 19, 2000
21
0
0
US
My name is Claude and I have pasted a copy of my syntax below for a new trigger that I have created but I have a question.<br>Can you, using the xp_sendmail functionality, use the sendmail synatx of @message or @subject, etc., to show not only the message content itself within the email you are trying to send but attach a field name (in this case the candidate name), to that same text?<br><br>In short, the end result I'm trying to accomplish with this email is to send an email that says:<br><br>SUBJECT: Resume Complete Notification<br><br>(BODY of email would say):&nbsp;&nbsp;<br>John Doe is done.<br><br>Can this be done?&nbsp;&nbsp;Because the syntax I have below only returns the subject text and the message text of 'is done'.&nbsp;&nbsp;It won't return the candidate name I am trying to reference using the field, @send_candidate.<br><br>Any suggestions anyone has would be appreciated.<br>Thanks,<br>Claude<br><br><br><br><br>CREATE TRIGGER [Trig_CandCompletion] ON [t_candidate1] <br>FOR INSERT, UPDATE, DELETE<br><br>AS<br>Declare @completed&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><br>SELECT @completed = B.completed FROM t_candidate1 B, INSERTED I<br>WHERE I.candidate_id = B.candidate_id and @completed &lt;&gt; '0'<br> <br>--send email back to call center when candidate has posted resume<br>select @send_candidate = @send_lname + ' , ' + @send_fname<br>select @sendmessage = @send_candidate + 'is done.' <br><br>exec master.dbo.xp_sendmail @recipients =&nbsp;&nbsp;'<A HREF="mailto:callme@staffmentor.net">callme@staffmentor.net</A>', @copy_recipients = '<A HREF="mailto:cjohnson@staffmentor.net">cjohnson@staffmentor.net</A>', <br>@message = @sendmessage, @subject = 'Resume Complete Notification'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top