X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DA7BF9DC837 for ; Wed, 28 Dec 2005 00:30:25 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68548-05 for ; Wed, 28 Dec 2005 00:30:23 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id E473B9DC80A for ; Wed, 28 Dec 2005 00:30:22 -0400 (AST) Received: from mail.apptechsys.com (mail.apptechsys.com [206.129.116.70]) by svr4.postgresql.org (Postfix) with ESMTP id 2A17E5AFC1C for ; Wed, 28 Dec 2005 04:30:21 +0000 (GMT) Received: by mail.apptechsys.com (Postfix, from userid 583) id 6E9CA7E52; Tue, 27 Dec 2005 20:30:17 -0800 (PST) Received: from ssh.apptechsys.com (ssh.apptechsys.com [206.129.116.141]) by mail.apptechsys.com (Postfix) with ESMTP id CF11E7E50; Tue, 27 Dec 2005 20:30:15 -0800 (PST) Date: Tue, 27 Dec 2005 20:30:15 -0800 (PST) From: Jeremy Drake To: Aftab Alam Cc: pgsql-hackers@postgresql.org Subject: Re: sending mail from Postgres In-Reply-To: <002801c60b5d$f6889c90$ec1010ac@aftabn463> Message-ID: References: <002801c60b5d$f6889c90$ec1010ac@aftabn463> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/1140 X-Sequence-Number: 77988 Code from perl cookbook, wrapped in plperlu wrapper not very portable, Net::SMTP would probably be better, and result in more portable perl code. Didn't test this - but it is copied straight from perl cookbook via google: http://www.unix.org.ua/orelly/perl/cookbook/ch18_04.htm CREATE OR REPLACE FUNCTION send_email(from_address text, to_address text, subject text, body text) RETURNS void AS $$ use Mail::Mailer; my ($from_address, $to_address, $subject, $body) = @_; my $mailer = Mail::Mailer->new("sendmail"); $mailer->open({ From => $from_address, To => $to_address, Subject => $subject, }) or die "Can't open: $!"; print $mailer $body; $mailer->close(); $$ LANGUAGE plperlu VOLATILE STRICT; On Wed, 28 Dec 2005, Aftab Alam wrote: > Hi there, > > How can i send mail form postgresql. > > any suggestion. > > thanx & regards > aftab > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > -- Don't steal; thou'lt never thus compete successfully in business. Cheat. -- Ambrose Bierce