Re: sending mail from Postgres

Поиск
Список
Период
Сортировка
От Jeremy Drake
Тема Re: sending mail from Postgres
Дата
Msg-id Pine.LNX.4.63.0512272019240.15097@garibaldi.apptechsys.com
обсуждение исходный текст
Ответ на sending mail from Postgres  ("Aftab Alam" <aalam@tatashare.com>)
Список pgsql-hackers
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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paesold
Дата:
Сообщение: Re: Possible savepoint bug
Следующее
От: Tom Lane
Дата:
Сообщение: plperl vs LC_COLLATE (was Re: Possible savepoint bug)