Received: from oxmail.ox.ac.uk (oxmail4.ox.ac.uk [163.1.2.33]) by hub.org (8.9.3/8.9.3) with ESMTP id MAA03803 for ; Thu, 6 Apr 2000 12:11:24 -0400 (EDT) (envelope-from moray.mcconnachie@computing-services.oxford.ac.uk) Received: from ermine.ox.ac.uk ([163.1.2.13]) by oxmail.ox.ac.uk with esmtp (Exim 2.10 #1) id 12dEp4-0001Fu-00; Thu, 6 Apr 2000 17:07:58 +0100 Received: from ermine.ox.ac.uk ([163.1.2.13] helo=moraypc ident=root) by ermine.ox.ac.uk with smtp (Exim 3.13 #1) id 12dEp4-00067P-00; Thu, 06 Apr 2000 17:07:58 +0100 Message-ID: <00ac01bf9fe2$1d4bdec0$760e01a3@oucs.ox.ac.uk> From: "Moray McConnachie" To: "Oscar Serrano" , "Tom Lane" Cc: "pgsql-interfaces@postgreSQL.org" References: <26948.955032666@sss.pgh.pa.us> Subject: Re: a trigger that sends an email Date: Thu, 6 Apr 2000 17:06:49 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Archive-Number: 200004/42 ----- Original Message ----- From: "Tom Lane" To: "Oscar Serrano" Cc: "pgsql-interfaces@postgreSQL.org" Sent: Thursday, April 06, 2000 3:51 PM Subject: Re: [INTERFACES] a trigger that sends an email > "Oscar Serrano" writes: > >>>> I thing I need to create a trigger. And I thing I need to create a > >>>> function that sends an email. > >>>> Is it possible? > >>>> May I do the function that sends the email in Perl? > > I don't think you can do this directly from a trigger, unless you want > to add the mail-sending function as a C extension to the backend. > You'll run into security restrictions. All of the higher-level trigger > programming languages we offer are "trusted", which means you can't do > anything that would affect files or programs outside the database. > Sending email is right out. Could one do a rule that used a dummy function, where the function called the Perl routine which generates the email? CREATE RULE emailer AS ON INSERT TO new_accounts DO SELECT new_account_email_function(NEW.emailaddress); or something like that? Or is this subject to the same restrictions? M.