File: comment_mail-sendmail.rb

package info (click to toggle)
tdiary 2.0.1-1sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 7,220 kB
  • ctags: 1,667
  • sloc: ruby: 20,044; lisp: 476; makefile: 91; sql: 32; sh: 31
file content (48 lines) | stat: -rw-r--r-- 1,618 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# comment_mail_sendmail.rb $Revision: 1.6 $
#
# sendmailȤäƥĥåߤ᡼Τ餻
#   ư롣
#
# Options:
#   ̤Ǥ(ĥåߥ᡼ϥץ饰):
#     @options['comment_mail.enable']
#          ᡼뤫ɤꤹ롣true()false(ʤ)
#          ̵false
#     @options['comment_mail.header']
#          ᡼Subject˻Ȥʸ󡣿ʬʤ褦˻ꤹ롣
#          ºݤSubjectϡֻʸ:-1פΤ褦ˡդȥֹ椬
#          դʸˡ%³ѻä硢
#          եեޥåȻ򸫤ʤĤޤաפʬ
#          ưŪղäʤʤ(ֹղä)
#          ̵ˤ϶ʸ
#     @options['comment_mail.receivers']
#          ᡼륢ɥ쥹ʸ󡣥ޤǶڤäʣǤ롣
#          ̵ˤɮԤΥɥ쥹ˤʤ롣
#  
#   tdiary.confǤΤ߻Ǥ:
#     @options['comment_mail.sendmail']
#          sendmailޥɤΥѥꤹ롣
#          ̵ˤϡ'/usr/sbin/sendmail'ס
#
# Copyright (c) 2003 TADA Tadashi <sho@spc.gr.jp>
# You can distribute this file under the GPL.
#
def comment_mail( text, to )
	begin
		sendmail = @conf['comment_mail.sendmail'] || '/usr/sbin/sendmail'
		open( "|#{sendmail} #{to.join(' ')}", 'w' ) do |o|
			o.write( text )
		end
	rescue
		$stderr.puts $!
	end
end

add_update_proc do
	comment_mail_send if @mode =~ /^(comment|trackbackreceive)$/
end

add_conf_proc( 'comment_mail', comment_mail_conf_label ) do
	comment_mail_basic_setting
	comment_mail_basic_html
end