proc sendmail { server to data } { set from "noreply@router.your.corp" set sck [socket $server 25] gets $sck ln if {! [string equal -length 1 "2" "$ln"] } { close $sck return 1 } puts $sck "HELO router.your.corp" flush $sck gets $sck ln if {! [string equal -length 1 "2" "$ln"] } { close $sck return 1 } puts $sck "MAIL FROM:<$from>" flush $sck gets $sck ln if {! [string equal -length 1 "2" "$ln"] } { close $sck return 1 } puts $sck "RCPT TO:<$to>" flush $sck gets $sck ln if {! [string equal -length 1 "2" "$ln"] } { close $sck return 1 } puts $sck "DATA" flush $sck gets $sck ln if {! [string equal -length 1 "3" "$ln"] } { close $sck return 1 } puts $sck "From: $from <$from>" puts $sck "To: $to <$to>" puts $sck "Subject: message from your router" puts $sck "Date: now" puts $sck "" puts $sck "$data" puts $sck "" puts $sck "." flush $sck gets $sck ln if {! [string equal -length 1 "2" "$ln"] } { close $sck return 1 } puts $sck "QUIT" flush $sck gets $sck ln close $sck return 0 } sendmail "160.114.55.227" "mc@cisco" "teszt uzenet!"