niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » PostgreSQL
Trigger email?
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
CSN
*nix forums addict


Joined: 01 Mar 2005
Posts: 91

PostPosted: Tue Mar 01, 2005 10:17 pm    Post subject: Trigger email? Reply with quote

Is it possible to setup a trigger so that every time a
certain field is changed, an email is sent? Using
pl/pgsql.

Thanks,
CSN




__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
Back to top
Christopher Browne
*nix forums beginner


Joined: 01 Mar 2005
Posts: 14

PostPosted: Tue Mar 01, 2005 10:23 pm    Post subject: Re: Trigger email? Reply with quote

cool_screen_name90001@yahoo.com (CSN) writes:
Quote:
Is it possible to setup a trigger so that every time a
certain field is changed, an email is sent? Using
pl/pgsql.

Something _like_ that is possible.

What I would do instead is for the trigger to cause a record to be put
into a table that might be called something like "submit_email".

An asynchronous process (that might look for NOTIFY requests!) would
then rummage thru submit_email to find messages it needs to send.

That allows you to keep this sort of thing under some degree of
control.

- It means you're not concurrently spawning 157 MTA connections; the
"mail manager" only needs to open _one_ connection

- It means you have some ability to manage how much mail gets sent out
at once.
--
let name="cbbrowne" and tld="cbbrowne.com" in String.concat "@" [name;tld];;
http://www.ntlug.org/~cbbrowne/linuxxian.html
A VAX is virtually a computer, but not quite.

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
Back to top
Jonathan Hedstrom
*nix forums beginner


Joined: 01 Mar 2005
Posts: 1

PostPosted: Tue Mar 01, 2005 11:53 pm    Post subject: Re: Trigger email? Reply with quote

Christopher Browne wrote:

Quote:
cool_screen_name90001@yahoo.com (CSN) writes:


Is it possible to setup a trigger so that every time a
certain field is changed, an email is sent? Using
pl/pgsql.



Something _like_ that is possible.


you can also do it directly with a trigger if you prefer:


CREATE TRIGGER alert_insert
AFTER INSERT OR UPDATE ON alert FOR EACH ROW
EXECUTE PROCEDURE alert_notify();

Where the alert_notify() function would then call pgmail() with a
meaningful subject and body etc -- see below

Quote:
What I would do instead is for the trigger to cause a record to be put
into a table that might be called something like "submit_email".

An asynchronous process (that might look for NOTIFY requests!) would
then rummage thru submit_email to find messages it needs to send.


at which point you could then use pgmail() to send the email


http://sourceforge.net/projects/pgmail/
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Fri Jan 09, 2009 3:26 am | All times are GMT
navigation Forum index » Databases » PostgreSQL
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts spoofed local email addresses watkykjy Postfix 0 Thu Nov 20, 2008 8:49 am
No new posts Transfer qmail email account to postfix server tallman Postfix 0 Thu Jun 05, 2008 12:43 pm
No new posts Postfix ldap and Rewriting sender email address endfx Postfix 2 Thu Apr 17, 2008 9:34 pm
No new posts Add BCC Based on Email Subject adoner Postfix 0 Tue Mar 18, 2008 6:12 pm
No new posts Postfix sending problem for local domain remote email monkey_magix Postfix 0 Mon Sep 10, 2007 10:17 am

Credit Counseling | Credit Reports | Myspace Layouts | Agencia de viagens | Vanzari Auto
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1106s ][ Queries: 16 (0.0343s) ][ GZIP on - Debug on ]