Re: [tkined] calling mail in nt

Alexios Zavras (zvr@hermes.aueb.gr)
Tue, 25 Aug 1998 17:20:52 +0300 (EET DST)

[I've sent it before but it bounced. Apologies if you've seen it before.]

Erik Schoenfelder wrote [edited]:
> On Tue, 18 Aug 1998 09:33:42 -9,
> "Bob Jaques" <jaques@imsn.net> said:
> Bob> I am moving from unix to nt with scotty. I use a modified
> Bob> monitor.tcl that emails events to me. How do i do this in nt
> Bob> ???
>
> The best idea coming into my mind, is to use an existing smtp service
> on your network. Opening a tcp-channel to port 25 of a known
> smtp-host, and speaking the necessary smtp dialog (HELO, MAIL FROM,
> RCPT TO, DATA, QUIT).

The quick-and-dirty solution (probably snatched off the net sometime):

proc send_mail {mailserver from to data} {
set s [socket $mailserver 25]
gets $s answer
if {[lindex $answer 0] != 220} {error $answer}
puts $s "MAIL FROM:<$from>"
flush $s
gets $s answer
if {[lindex $answer 0] != 250} {error $answer}
puts $s "RCPT TO:<$to>"
flush $s
gets $s answer
if {[lindex $answer 0] != 250} {error $answer}
puts $s DATA
flush $s
gets $s answer
if {[lindex $answer 0] != 354} {error $answer}
puts $s $data
flush $s
puts $s .
flush $s
gets $s answer
if {[lindex $answer 0] != 250} {error $answer}
close $s
}

A more complete solution is included in Andreas Kupries' Pool collection:
http://www.westend.com/%7Ekupries/doc/pool/index.htm

- -- zvr --
+---------------------------+ Alexios Zavras (-zvr-)
| H eytyxia den exei enoxes | zvr@aueb.gr
+-----------------------zvr-+

--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.