Sending email from PL/pgsql

Started by Nonameover 22 years ago7 messagesgeneral
Jump to latest
#1Noname
aderuwe@aqs-carcontrol.be

Hey,

I was wondering if it is possible to send email from within PL/pgsql.
I'd like to do this to avoid code duplication in multiple frontends.
Can this be done somehow? Or do I have to write a C function for this
purpose? If so, how does one go about that?

Thanks,

--
Alexander Deruwe - aderuwe@aqs-carcontrol.be
AQS-CarControl

#2Shridhar Daithankar
shridhar_daithankar@myrealbox.com
In reply to: Noname (#1)
Re: Sending email from PL/pgsql

Alexander Deruwe wrote:

I was wondering if it is possible to send email from within PL/pgsql.
I'd like to do this to avoid code duplication in multiple frontends.
Can this be done somehow? Or do I have to write a C function for this
purpose? If so, how does one go about that?

You can write a postgresql function in C that calls libesmtp to send mails.

http://www.stafford.uklinux.net/libesmtp/

Shridhar

#3Pavel Stehule
pavel.stehule@gmail.com
In reply to: Noname (#1)
Re: Sending email from PL/pgsql

Hello

You can use PgSendMail

http://sourceforge.net/project/showfiles.php?group_id=35804

Pavel

On Thu, 30 Oct 2003, Alexander Deruwe wrote:

Show quoted text

Hey,

I was wondering if it is possible to send email from within PL/pgsql.
I'd like to do this to avoid code duplication in multiple frontends.
Can this be done somehow? Or do I have to write a C function for this
purpose? If so, how does one go about that?

Thanks,

#4Gianni Mariani
gianni@mariani.ws
In reply to: Noname (#1)
Re: Sending email from PL/pgsql

Alexander Deruwe wrote:

Hey,

I was wondering if it is possible to send email from within PL/pgsql.
I'd like to do this to avoid code duplication in multiple frontends.
Can this be done somehow? Or do I have to write a C function for this
purpose? If so, how does one go about that?

You can do it from pgperl and you can call a pgperl fruntion from pl/pgsql.

#5Tino Wildenhain
tino@wildenhain.de
In reply to: Noname (#1)
Re: Sending email from PL/pgsql

Hi,

Alexander Deruwe schrieb:

Hey,

I was wondering if it is possible to send email from within PL/pgsql.
I'd like to do this to avoid code duplication in multiple frontends.
Can this be done somehow? Or do I have to write a C function for this
purpose? If so, how does one go about that?

And to make it complete, now that plpython is unrestricted,
you can also use plpythonu for this tasks. Works very well
since this was one of the tests I had to make just after
I got my hands on plpythonu ;-)

For example including query results as attachment appeals to me.

Regards
Tino

#6Robert Treat
xzilla@users.sourceforge.net
In reply to: Tino Wildenhain (#5)
Re: Sending email from PL/pgsql

On Thu, 2003-10-30 at 08:11, Tino Wildenhain wrote:

Hi,

Alexander Deruwe schrieb:

Hey,

I was wondering if it is possible to send email from within PL/pgsql.
I'd like to do this to avoid code duplication in multiple frontends.
Can this be done somehow? Or do I have to write a C function for this
purpose? If so, how does one go about that?

And to make it complete, now that plpython is unrestricted,
you can also use plpythonu for this tasks. Works very well
since this was one of the tests I had to make just after
I got my hands on plpythonu ;-)

Actually you guys left out pltclu which can do it, code can be found in
the cookbook:

http://www.brasileiro.net/postgres/cookbook/view-one-recipe.adp?recipe_id=292

Robert Treat
--
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

#7Jan Wieck
JanWieck@Yahoo.com
In reply to: Tino Wildenhain (#5)
Re: Sending email from PL/pgsql

Tino Wildenhain wrote:

Hi,

Alexander Deruwe schrieb:

Hey,

I was wondering if it is possible to send email from within PL/pgsql.
I'd like to do this to avoid code duplication in multiple frontends.
Can this be done somehow? Or do I have to write a C function for this
purpose? If so, how does one go about that?

And to make it complete, now that plpython is unrestricted,
you can also use plpythonu for this tasks. Works very well
since this was one of the tests I had to make just after
I got my hands on plpythonu ;-)

Complete? You forgot PL/TclU at least ;-)

Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck@Yahoo.com #