From: | Christophe Garault <christophe(at)garault(dot)org> |
---|---|
To: | Liste PostgreSQL Fr <pgsql-fr-generale(at)postgresql(dot)org> |
Subject: | Re: Fonction en Perl |
Date: | 2005-05-02 18:47:37 |
Message-ID: | 427675C9.2000705@garault.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-fr-generale |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Christophe Garault a écrit :
>> Bonjour,
>>
>> Ci-dessous le code d'une petite fonction en Perl que je n'arrive
>> pas à faire fonctionner:
>>
Bon je me répond à moi-même car j'ai trouvé l'erreur. Voici donc pour
ceux qui seraient interessés une petite fonction en Perl pour envoyer
un mail depuis PostgreSQL:
CREATE OR REPLACE FUNCTION udf_mail( text, text, text) RETURNS int2
AS $$
use strict;
use MIME::Lite;
my ($dest,$subj,$data) = @_;
my $msg;
$msg = MIME::Lite->new(
From => 'dba(at)mondomaine(dot)tld',
To => $dest,
Subject => $subj,
Data => $data
);
$msg->send;
return 1;
$$ LANGUAGE 'plperlu' VOLATILE;
NB: il faut avoir un smtp sur le même serveur, mais celà doit pouvoir
facilement être contourné.
- --
Christophe Garault
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD4DBQFCdnXJJ5Nh3YMYAQsRAvqDAJd190C8vMPKgRSYpFh5IE3qAAQHAJ9E+tJc
5o798ZatAYtZSApFFJkhAQ==
=T7No
-----END PGP SIGNATURE-----
From | Date | Subject | |
---|---|---|---|
Next Message | Francois MOINEL | 2005-05-02 19:50:09 | Choix Stratégique ... |
Previous Message | Christophe Garault | 2005-05-02 14:49:51 | Fonction en Perl |