Personal tools

Notification how-to

by ats last modified 2005-11-19 22:06

How to send email when comments or trackbacks are added.

You can receive email when comment/trackback add. Follow instructions bellow.

  1. Add Mail Host object.
  2. In management screen,click contents tab.
  3. Move into methods folder.

COREBlog calls some notification method in methods folder.


To send email when comment added,add PythonScript named addCommentHook. You need one parameter d. And set Proxy roles for the script.

Body of script is something like...

 try:
     mailhost=getattr(context, \
                      context.superValues('Mail Host')[0].id)
 except:
     raise AttributeError, "Mail Host object cant be found."
 
 to_addr   = "your@email.address"
 from_addr = "sender@email.address"
 
 mMsg = """To: %s
 From: %s
 Mime-Version: 1.0
 Content-Type: text/plain;
 
 Author   :%s
 Title    :%s
 URL      :%s
 EntryID  :%s
 Body     :
 %s""" % (to_addr , from_addr ,  d["author"] , d["title"] ,\
         d["url"] , str(d["parent_id"]) , d["body"])
 
 mTo = to_addr
 mFrom = from_addr
 mSubj = 'A comment added!'
 
 mailhost.send(mMsg, mTo, mFrom, mSubj)

To send email when comment added,add PythonScript named addTrackbackHook. You need one parameter d. And set Proxy roles for the script.

Body of script is something like...

 try:
     mailhost=getattr(context, \
                     context.superValues('Mail Host')[0].id)
 except:
     raise AttributeError, "cant find a Mail Host object"
 
 to_addr   = "your@email.address"
 from_addr = "sender@email.address"
 
 mMsg = """To: %s
 From: %s
 Mime-Version: 1.0
 Content-Type: text/plain;
 
 Title      ?F%s
 URL        ?F%s
 BlogName   ?F%s
 Body       ?F
 %s""" % (to_addr,from_addr,d["title"],d["url"],\
                                  d["blog_name"],d["excerpt"])
 
 mTo = to_addr
 mFrom = from_addr
 mSubj = 'Trackback added!!'
 
 mailhost.send(mMsg, mTo, mFrom, mSubj)
That's all.

Have fun :-).

You are here: Home Hot-Tos Notification how-to
About COREBlog
COREBlog2 (for Plone users)
The current version of COREBlog2 (for Plone) is 0.982b (released 2007/4/13)
Download now!
How-Tos
To learn more about COREBlog visit the How Tos
Mailing list for COREBlog users
There is a mailinglist for COREBlog in English. Thanks, Klaus san :-).
COREBlog2 (for Plone users)
The current version of COREBlog2 (for Plone) is 0.982b (released 2007/4/13)
Download now!
Bugs/Feature Requests
If you have bug reports or feature requests, please add new ticket to trac for COREBlog2. Be sure to write your name and email address so I can contact to you :-).
COREBlog (for Zope users)
The current version of COREBlog (for Zope) is 1.2.5 (relaased 2006/04/03)
Download now!
How-Tos
To learn more about COREBlog visit the How Tos
Mailing list for COREBlog users
There is a mailinglist for COREBlog in English. Thanks, Klaus san :-).
 

Powered by Plone, the Open Source Content Management System