Hi again,<br><br>This how i have solved it now, it probably could be done in a better way but at least it seems to be working:<br><br>I have added the send mail function twice to be able to get the full information to the blog admin but only the "comment added" and URL to the commentators.
<br><br>Also i have moved the send notification flag to commentators part as the blog admin always should be notified but now i can turn off the commentator notification.<br><br>I only have one small problem left, with this aproach the commentator gets a notification mail even when he makes the comment himself, is there anyone who knows an easy way to fix that, it would be very welcome :) .
<br><br><br>---------------------------------------------------------------------------------------------<br><br>#Send notify mail to blog admin<br><br>try:<br> to_addr = context.getNotify_to()<br> from_addr = context.getNotify_from
()<br> msgbody = context.translate('comment_notify_body')<br> elements = {}<br> for k in ('title','author','url','body'):<br> if REQUEST.form.has_key(k):<br> elements[k] =
REQUEST.form[k]<br> else:<br> elements[k] = ''<br> elements['post_ip'] = REQUEST.getClientAddr()<br> elements['entry_url'] = context.absolute_url()<br> msgbody = msgbody % (elements)
<br> msgsubject = context.translate('comment_notify_title')<br> mgsheader = """To: %s<br>From: %s<br>Mime-Version: 1.0<br>Content-Type: text/plain; Charset=utf-8<br><br>""" % (to_addr,from_addr)
<br> cbtool.send_mail(mgsheader+msgbody, to_addr, from_addr, msgsubject)<br><br> if context.getSend_comment_notification():<br> #Get email addresses<br> com_list = context.getComment()<br> addr_list = []
<br> for com in com_list:<br> if not addr_list.count(com.getEmail()):<br> addr_list.append(com.getEmail())<br><br> #Send notify mail if need to commentators<br><br> try:<br> for addr in addr_list:
<br> to_addr = addr<br> from_addr = context.getNotify_from()<br> msgbody = context.absolute_url()<br> msgsubject = context.translate('comment_notify_title')
<br> mgsheader = """To: %s<br>From: %s<br>Mime-Version: 1.0<br>Content-Type: text/plain; Charset=utf-8<br><br>""" % (to_addr,from_addr)<br> cbtool.send_mail(mgsheader+msgbody, to_addr, from_addr, msgsubject)
<br><br> except Exception,e:<br> log( 'COREBlog2/cbaddComment: '<br> 'Some exception occured, %s' % e )<br><br> <br>except Exception,e:<br> log( 'COREBlog2/cbaddComment: '
<br> 'Some exception occured, %s' % e )<br><br>---------------------------------------------------------------------------------------------<br><br><br><br><br><br><div><span class="gmail_quote">On 12/21/06,
<b class="gmail_sendername">Niklas</b> <<a href="mailto:nekstrand@gmail.com">nekstrand@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thanx again,<br><br>I have not had the time to check the last code but i'm sure it will work fine.<br><br>The checkbox is also fine to leave out, the only problem would be if someone gets mail and tells me he don't like to have it, but they will have to live with it. I always have the possibility to erase their address in the comment.
<br><br>Is it ok if i add a feature request and adds this sample code? and adds you to the reference Mr NAKAI?<br><span class="sg"><br>/Niklas</span><div><span class="e" id="q_10fa3c52b9d5ea15_2"><br><br><br><br><div><span class="gmail_quote">
On 12/20/06, <b class="gmail_sendername">Yusuke NAKAI
</b> <<a href="mailto:nyusuke@nagosui.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">nyusuke@nagosui.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>> I tried to find where to change to BCC but could not find the right<br>> reference, i agree with this beeing a problem, is it hard to change?.<br><br>Notification mail is send by cbtool.send_mail() method:<br>
<br>--------------------------------------------------<br> ...<br> mgsheader = """To: %s<br>From: %s<br>Mime-Version: 1.0<br>Content-Type: text/plain; Charset=utf-8<br><br>""" % (to_addr,from_addr)
<br> cbtool.send_mail(mgsheader+msgbody, to_addr, from_addr, ...<br> ^^^^^^^^^^^^^^^^<br>--------------------------------------------------<br><br>This method is defined in COREBlog2/COREBlogTool.py from line 238. And
<br>this uses send() method of SecureMailHost. But this method can't handle BCC.<br><br>To handle BCC, using secureSend() method of SecureMailHost is needed.<br>But this approach seems to be a bit trouble. How about taking separate
<br>sending approach?<br><br>To send mail separately, you can use 'for' loop for addr_list.<br>For example:<br><br>--------------------------------------------------<br>#Send notify mail if need<br>if context.getSend_comment_notification
():<br> try:<br> for addr in addr_list:<br> to_addr = addr<br> ...<br>--------------------------------------------------<br><br><br>> This might be to ask for to much but i will still ask, is it a hard job
<br>> to add a check box (notify me when furter comments are added to this<br>> post) in the comment form and have the mails selected bu this check box?<br><br>It seems to be hard. At least beyond my reach.<br><br>
<br>Regards,<br><br>--<br>Yusuke NAKAI<br><br>mail: <a href="mailto:nyusuke@nagosui.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">nyusuke@nagosui.org</a><br>web : <a href="http://nagosui.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://nagosui.org</a><br>_______________________________________________
<br>COREblog-en mailing list<br><a href="mailto:COREblog-en@postaria.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">COREblog-en@postaria.com</a><br><a href="http://postaria.com/mailman/listinfo/coreblog-en" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://postaria.com/mailman/listinfo/coreblog-en</a><br>
Unsubscription writing to <a href="mailto:coreblog-en-leave@postaria.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">coreblog-en-leave@postaria.com</a><br></blockquote></div><br><br clear="all">
<br></span></div><div><span class="e" id="q_10fa3c52b9d5ea15_3">-- <br>With best regards / med vänlig hälsning<br><br>Niklas
</span></div></blockquote></div><br><br clear="all"><br>-- <br>With best regards / med vänlig hälsning<br><br>Niklas