Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Send email from PostgreSQL, may I ?



Hi,
On Fri, 2006-10-27 at 11:11 +0000, Gerson Machado wrote:
> I need send email directly from PG with on function, where locate
> this ?

You can send e-mails via pltclu or plperlu, more is also possible.

http://sourceforge.net/projects/pgmail/ <- This is tcl one.

plperlu one is attached. I don't remember where I got this one.

Regards,
-- 
The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/

create or replace function mymail() returns integer as '

 #!/usr/bin/perl
  my ($sendTo, $Subject, $Message)=(''mymail ( at ) mail ( dot ) de'', ''TESTSubject'',''TESTMSG'');
  use Net::SMTP;
  my $smtp=Net::SMTP->new("localhost");

  $smtp->mail("frommail\ ( at ) mail ( dot ) de");
  $smtp->recipient($sendTo);
  $smtp->data();
  $smtp->datasend("To: $sendTo\n");
  $smtp->datasend("Subject: $Subject\n");
  $smtp->datasend("Content-Type: text/plain;\n\n");
  $smtp->datasend("$Message and somethning TEST else \n");
  $smtp->dataend();
  $smtp->quit();
  return 1;
' language 'plperlu';

Attachment: signature.asc
Description: This is a digitally signed message part



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group