This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

enote.tcl how to make it works with windrops ?

Old posts that have not been replied to for several years.
Locked
P
Pitchat
Op
Posts: 122
Joined: Tue Feb 18, 2003 11:24 pm
Location: Hebertville Quebec Canada
Contact:

enote.tcl how to make it works with windrops ?

Post by Pitchat »

hi
i wonder if it is possible to make that script works on a windrop installed on my home computer using the smtp servver from my email account

any help welcome

Code: Select all

##################################
### eNote.tcl - nix@underz.org ###
##################################
#             .eCfg              #
##################################
#set this to 1 if you use sendmail - 0=no
set eNoteCfg(sendmail) 0
#and set the path bellow
set eNoteCfg(smpath) "/usr/sbin/sendmail"

#you can use an SMTP server...
set eNoteCfg(smtp) smtp.videotron.ca
#port for the SMTP server
set eNoteCfg(port) 25

##################################

bind dcc - eNote eNote
proc eNote {hand idx text} {
	global eNote botnick
	if {([string tolower [lindex $text 0]] == "none") && ([info exists eNote([string tolower $hand])])} {
		putidx $idx "Removed $eNote([string tolower $hand])."
		unset eNote([string tolower $hand])
		eNoteSave
		return 1
	} elseif {([string tolower [lindex $text 0]] == "none") && (![info exists eNote([string tolower $hand])])} {
		putidx $idx "there is no address to delete"
		return 0
	}
	if {([string match *@*.* $text]) && ([llength $text] == 1)} {
		set eNote([string tolower $hand]) $text
		eNoteSave
		putidx $idx "All note will be forwarded to $text."
		return 1
	} elseif {([string match *@*.* $text]) && ([llength $text] > 1)} {
		eNoteSend $hand [lindex $text 0] [join [lrange $text 1 end]]
		putidx $idx "eNoting [lindex $text 0]..."
		return 0
	}
	putidx $idx "Usage:\n .eNote <email> (set your email) \n .eNote <none> (delete your email) \n .eNote <to email> <message> (send an email to someone)"
	if {[info exists eNote([string tolower $hand])]} {putidx $idx "Your email: $eNote([string tolower $hand])"}
	return 0
}
bind filt - ".note *" eNoteFilt
proc eNoteFilt {idx arg} {
	global eNote
	if {([validuser [lindex $arg 1]]) && ([info exists eNote([string tolower [lindex $arg 1]])])} {
		set test 1
		if {[hand2idx [lindex $arg 1]] > -1} {
			if {([getdccaway [hand2idx [lindex $arg 1]]] == "") && ([getdccidle [hand2idx [lindex $arg 1]]] < 1800)} {set test 0}
		}
		if {$test} {eNoteSend [idx2hand $idx] $eNote([string tolower [lindex $arg 1]]) [join [lrange $arg 2 end]]}
	}
	return $arg
}
proc eNoteSend {from to texte} {
	global eNoteCfg botnick
	if {$eNoteCfg(sendmail)} {
		if {![catch {open "| $eNoteCfg(smpath) -f $from@$botnick -t" "w"} ml]} {
			puts $ml "To: $to"
			puts $ml "From: $from@$botnick"
			puts $ml "$texte"
			close $ml
		}
	} else {
		if {![catch {connect $eNoteCfg(smtp) $eNoteCfg(port)} ml]} {
			putidx $ml "HELO $eNoteCfg(smtp)"
			putidx $ml "MAIL FROM: $from@$botnick.bot"
			putidx $ml "RCPT TO: $to"
			putidx $ml "DATA"
			putidx $ml "$texte"
			putdcc $ml "."
			putdcc $ml "QUIT"
		}
	}
}
proc eNoteSave {} {
	global eNote
	set f [open eNote.tcl.conf w]
	foreach c [array names eNote] {puts $f "$c $eNote($c)"}
	close $f
}
proc eNoteLoad {} {
	global eNote
	if {![file exists "eNote.tcl.conf"]} {set f [open eNote.tcl.conf w]; close $f; return 0}
	set f [open eNote.tcl.conf r]
	while {[gets $f line] >= 0} {set eNote([lindex $line 0]) [lindex $line 1]}
	close $f
}
eNoteLoad
bind dcc n eCfg eCfg
proc eCfg {hand idx text} {
	global eNoteCfg
	if {[string tolower [lindex $text 0]] == "type"} {
		if {$eNoteCfg(sendmail) == 0} {set eNoteCfg(sendmail) 1; putidx $idx "using sendmail now"; eCfgSave
		} else {set eNoteCfg(sendmail) 0; putidx $idx "using SMTP now"}
		return 1
	} elseif {[string tolower [lindex $text 0]] == "smpath"} {
		if {[lindex $text 1] != ""} {set eNoteCfg(smpath) "[lindex $text 1]"; putidx $idx "Done"; eCfgSave; return 1
		} else {putidx $idx "Usage: .eCfg smpath <path to sendmail>"; return 0}
	} elseif {[string tolower [lindex $text 0]] == "smtp"} {
		if {[lindex $text 1] != ""} {set eNoteCfg(smtp) "[lindex $text 1]"; putidx $idx "Done"; eCfgSave; return 1
		} else {putidx $idx "Usage: .eCfg smtp <ip of your smtp server>"; return 0}
	} elseif {[string tolower [lindex $text 0]] == "port"} {
		if {[lindex $text 1] != ""} {set eNoteCfg(port) "[lindex $text 1]"; putidx $idx "Done"; eCfgSave; return 1
		} else {putidx $idx "Usage: .eCfg port <port of your smtp server>"; return 0}
	} elseif {[string tolower [lindex $text 0]] == "status"} {
		putidx $idx "          eNote.tcl          "
		if {$eNoteCfg(sendmail)} {putidx $idx "Using sendmail ($eNoteCfg(smpath))"
		} else {putidx $idx "Using SMTP server at $eNoteCfg(smtp) port $eNoteCfg(port)"}
		return 1
	} else {
		putidx $idx "Usage: \n .eCfg TYPE   <toggle SMTP/sendmail> \n .eCfg SMPATH <path to sendmail> \n .eCfg SMTP   <ip of the smtp server> \n .eCfg PORT   <port of the smtp server>"
		return 0
	}
}
proc eCfgSave {} {
	global eNoteCfg
	set f [open eNote.tcl.setup w]
	foreach c [array names eNoteCfg] {puts $f "$c $eNoteCfg($c)"}
	close $f
}
proc eCfgLoad {} {
	global eNoteCfg
	if {![file exists "eNote.tcl.setup"]} {set f [open eNote.tcl.setup w]; close $f; return 0}
	set f [open eNote.tcl.setup r]
	while {[gets $f line] >= 0} {set eNoteCfg([lindex $line 0]) [lindex $line 1]}
	close $f
}
eCfgLoad

putlog "\002eNote.tcl\002 - (.eNote / .eCfg)"
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Maybe if you told us what was wrong with the above, we can direct you more.
User avatar
arcane
Master
Posts: 280
Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:

Post by arcane »

hm... im not sure, but i think i read that only linux/unix can send emails from os. windows needs a program i think. i would say, the script above uses shell-functions to send an email. and windows does not have these functions.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Just spotted that too.

Windows doesn't provide the sendmail application, and thus can't use it to send the mail.

What you can do, is download Tcllib, and modify your code, to use the SMTP library included in it.
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

or simple open a port to your isp smtp server and write the smtp code by your own, just google for it.
User avatar
CoolCold
Voice
Posts: 9
Joined: Thu Feb 27, 2003 11:29 pm
Location: Moscow,RU

Post by CoolCold »

You may try to use CYGWIN http://www.cygwin.com
I'm not sure but postfix exists in current release....
Locked