automatic email notification

Results 1 to 2 of 2

Thread: automatic email notification

  1. #1
    Join Date
    Dec 1969

    Default automatic email notification

    I need to fire off an automatic email to a site administrator notifying them when a user has been deleted from the system via the front end. I&#039;ve been using xp sendmail but I suspect my syntax is wrong. I&#039;ve put the mail code at the end of my deletion code so that the email is the last event to happen.<BR><BR>&#060;% Set cn_enquiry = Server.CreateObject ("ADODB.Connection")<BR>cn_enquiry.Open _<BR> "Driver={SQL Server};Server=matt;UID=skillsmatrix;PWD=bla;Datab ase=skills_matrix;"<BR>sql_enquiry="master..xp_sen dmail @recipients = &#039;, @message = &#039;"& "DELETED: the following employee has been deleted from the Skills Matrix" & request("ctd_id") & chr(13) & chr(13) &"&#039;, @subject = &#039;Employee deletion&#039; "<BR> %&#062; <BR><BR>&#060;%set rs_enquiry = cn_enquiry.execute(sql_enquiry)%&#062;<BR><BR>Any ideas on why this isn&#039;t working?

  2. #2
    Join Date
    Dec 1969

    Default Triggers

    You can set an trigger on the table &#039;Users&#039; which executes the sp_sendmail:<BR><BR>CREATE TRIGGER Users_delete<BR> ON Users FOR DELETE<BR>AS<BR>DECLARE @Username nvarchar (25)<BR><BR>SELECT @username = Username from deleted<BR><BR>exec sp_sendmail [look up the correct syntax for this sp]<BR><BR>In the body you can add the username (or id etc) using @username<BR><BR>Good luck<BR><BR>Peter<BR><BR>(p.s. in order to work with the sp_sendmail sproc you have to set up an valid MAPI profile)<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts