public inbox for [email protected]
help / color / mirror / Atom feedFrom: Jeremy Drake <[email protected]>
To: Aftab Alam <[email protected]>
Cc: [email protected]
Subject: Re: sending mail from Postgres
Date: Tue, 27 Dec 2005 20:30:15 -0800 (PST)
Message-ID: <[email protected]> (raw)
In-Reply-To: <002801c60b5d$f6889c90$ec1010ac@aftabn463>
References: <002801c60b5d$f6889c90$ec1010ac@aftabn463>
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
view thread (26+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: sending mail from Postgres
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox