sending via smtp (code included)
sigzero_at_gmail.com
Date: 03/07/05
- Next message: Mark Roseman: "Re: What's the status of Tcl 9.0?"
- Previous message: Khaled: "Re: Expect: How to avoid printing stdout of spawned process?"
- Next in thread: sigzero_at_gmail.com: "Re: sending via smtp (code included)"
- Reply: sigzero_at_gmail.com: "Re: sending via smtp (code included)"
- Reply: Vaclav Snajdr: "Re: sending via smtp (code included)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 7 Mar 2005 05:47:48 -0800
I have a script that sends me a log file via smtp. The log file is
generally 65-75k. If I create a log file with just the word "test" in
it the script works fine. When I try it against the actual log file I
get:
error flushing "sock672": invalid argument
while executing
"flush $channel"
(procedure "mime::copymessageaux" line 178)
invoked from within
"mime::copymessageaux $token $channel "
invoked from within
"::mime::copymessage $part $state(sd) "
invoked from within
"wtextaux $token $part "
invoked from within
"smtp::sendmessage $token -recipients $recipient -servers
$email_server"
(procedure "send_simple_message" line 8)
invoked from within
Any ideas?
I am using:
ActiveState Tcl 8.4.9
Windows 2000 Server
Robert
No Laughing Beyond This Point! :-)
=======================================
# Created: January 17, 2005
#
# Purpose: This script will run the Mincom Ellipse MSQUPD.EXE
# to update the Ellipse popups database. It will then
# email the msqupd.log file to the admin for further action.
#
# Version: 0.6
# version 0.01 initial skeleton
# version 0.02 added some pseudo code to get the flow of the script
# version 0.03 added some real code to do stuff
# version 0.04 everything but the archiving
# version 0.05 added the deleting of the Ellipse cache directory
# version 0.06 added the deleting of olf log files
# If the day is Sunday, get rid of log files
puts "========================"
puts " Deleting Old Log Files "
puts "========================\n"
set theDay [clock format [clock scan now] -format %u]
set logDir [file join {M:\Path\To\ParadoxMaster}]
if {$theDay == 7} {
foreach logFiles [glob -nocomplain $logDir/msqupd.log*] {
file delete -force $logFiles
}
}
puts "======================"
puts " Deleting Users CACHE "
puts "======================\n"
set mimsCache "MIMS Cache"
foreach cacheDir [glob -nocomplain M:/users/*/Ellipse/temp/$mimsCache]
{
file delete -force $cacheDir
}
set msqupd [file join {M:\\Path\To\msqupd.exe}]
set dist1 "elldev"
puts "==================="
puts " Refreshing ELLDEV "
puts "==================="
exec $msqupd $dist1
proc send_simple_message {recipient email_server subject body} {
package require smtp
package require mime
set token [mime::initialize -canonical text/plain -string $body]
mime::setheader $token Subject $subject
smtp::sendmessage $token -recipients $recipient -servers
$email_server
mime::finalize $token
}
set logfile [file join {M:\Path\To\msqupd.log}]
set channel [open $logfile r]
set msgBody [read $channel]
set uname $::env(COMPUTERNAME)
set subText "Popup Refresh Report"
set textDate [clock format [clock scan now] -format %Y%m%d]
set msgSubj "$uname: $subText $textDate"
# this line has been changed to mask the info
send_simple_message me@me.com smtp.server.name $msgSubj $msgBody
close $channel
# archive the file
set suffix [clock format [clock scan now] -format %Y%m%d%H%M%S]
file rename $logfile $logfile.$suffix
exit
- Next message: Mark Roseman: "Re: What's the status of Tcl 9.0?"
- Previous message: Khaled: "Re: Expect: How to avoid printing stdout of spawned process?"
- Next in thread: sigzero_at_gmail.com: "Re: sending via smtp (code included)"
- Reply: sigzero_at_gmail.com: "Re: sending via smtp (code included)"
- Reply: Vaclav Snajdr: "Re: sending via smtp (code included)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|