Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

sending via smtp (code included)

18 views
Skip to first unread message

sig...@gmail.com

unread,
Mar 7, 2005, 8:47:48 AM3/7/05
to
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 m...@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

sig...@gmail.com

unread,
Mar 7, 2005, 9:16:48 AM3/7/05
to
It must have something to do with the file closing. If I create the log
file first with "test" in it and then I run the program that creates
the log file in the first place, I get an email with "Test" at the top
and 2/3 of the actual log file itself. Strange. I run this on multiple
servers and this is the only one that I have issues with.

sig...@gmail.com

unread,
Mar 7, 2005, 11:23:36 AM3/7/05
to
Solved...Trf was causing a problem. Per advice given in Tcl chat room I
did:

set ::smtp::trf 0

And it works now...

Robert

Roy Terry

unread,
Mar 7, 2005, 11:55:01 AM3/7/05
to
<sig...@gmail.com> wrote in message
news:1110212616.7...@g14g2000cwa.googlegroups.com...


Yikes. This has now been going
on for several years. I solved a MIME
send issue back in 2003 by disabling
trf. Tom Miller recently e-mailed me inquiring
about it
tcllib-Bugs-754920 ] text/html file content causes socket error

For some reason
use of trf in smtp.tcl causes breakage
(apparently by causing the socket to
be closed prematurely).
and for some reason doesn't
get fixed. Perhaps it's too hard
to reproduce for the developer.

Roy

PS: It appears Marshall Rose
though assigned a number of
bug reports, is no longer available
to work on them. :^(
>
> Robert
>


sig...@gmail.com

unread,
Mar 7, 2005, 1:02:51 PM3/7/05
to
Hmm, that isn't good.

Robert

Robert

unread,
Mar 7, 2005, 8:17:23 PM3/7/05
to
On 3/7/05 1:02 PM, in article
1110217804....@g14g2000cwa.googlegroups.com, "sig...@gmail.com"
<sig...@gmail.com> wrote:

> Hmm, that isn't good.
>
> Robert
>

Do we need to raise it again? Or is nobody assigned the Trf module anymore?

Robert

Earl Grieda

unread,
Mar 7, 2005, 10:12:07 PM3/7/05
to

<sig...@gmail.com> wrote in message
news:1110212616.7...@g14g2000cwa.googlegroups.com...

What is trf?

Thanks.


Vaclav Snajdr

unread,
Mar 8, 2005, 6:55:18 AM3/8/05
to
Some weeks ago I had troubles with smtp/mime if
the text (text body) has not ended with one blank.
It was tcllib1.7. I wrote about it here. Search in
the messages for "smtp".

sig...@gmail.com wrote:

--
Vaclav Snajdr

sig...@gmail.com

unread,
Mar 8, 2005, 3:21:37 PM3/8/05
to

bbea...@desanasystems.com

unread,
Mar 8, 2005, 4:35:13 PM3/8/05
to

This web page states for TRF that it is:
An extension based upon the principle of [stacked channel]s.

So, if the original poster had not been using an unsupported extension
(not in TCLLIB) then he would not have had his email problem? Is that
correct?

Pat Thoyts

unread,
Mar 8, 2005, 7:30:44 PM3/8/05
to
Robert <sig...@gmail.com> writes:

No - we are aware of it and there is already a bug raised.

--
Pat Thoyts http://www.zsplat.freeserve.co.uk/resume.html
To reply, rot13 the return address or read the X-Address header.
PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD

Robert

unread,
Mar 8, 2005, 7:36:38 PM3/8/05
to
In article <1110317713.2...@l41g2000cwc.googlegroups.com>,
bbea...@desanasystems.com wrote:

I have no idea as to the answer. I was only posting what I learned in
the Tcl chat room to solve my particular problem.

Robert

Robert

unread,
Mar 8, 2005, 8:00:13 PM3/8/05
to
In article <87zmxdw...@binky.patthoyts.tk>,
Pat Thoyts <c...@mfcyng.serrfreir.pb.hx> wrote:

> Robert <sig...@gmail.com> writes:
>
> >On 3/7/05 1:02 PM, in article
> >1110217804....@g14g2000cwa.googlegroups.com, "sig...@gmail.com"
> ><sig...@gmail.com> wrote:
> >
> >> Hmm, that isn't good.
> >>
> >> Robert
> >>
> >Do we need to raise it again? Or is nobody assigned the Trf module anymore?
>
> No - we are aware of it and there is already a bug raised.

I understand that but if Mr. Terry is correct, 2 years is a long time
for a bug to be open. Is there just no one to work on it?

Robert

Roy Terry

unread,
Mar 9, 2005, 2:21:10 AM3/9/05
to

<bbea...@desanasystems.com> wrote in message
news:1110317713.2...@l41g2000cwc.googlegroups.com...
I would say that's not correct because trf is a mainstream extension
and the mime package of tcllib relies on trf for some of its operations.
So, for example, if you install Tcl via the excellent ActiveState package
you
will get trf and tcllib both in the bargain. Really it ought to just work,
but in this
case the bug was a subtle one. News is coming I believe that this one is
finally solved thanks to Andreas Kupries diligence. :*)

Roy
>


Bob Techentin

unread,
Mar 9, 2005, 9:11:49 AM3/9/05
to
<sig...@gmail.com> wrote
> >
> > What is trf?
>
> http://wiki.tcl.tk/479
>

That page says "This package is part of ActiveTcl." I don't see it
in the Active Tcl docs, but 'package require Trf' tells me that it is
there. Is it hidden for some reason, or just not documented?

Bob
--
Bob Techentin techenti...@NOSPAMmayo.edu
Mayo Foundation (507) 538-5495
200 First St. SW FAX (507) 284-9171
Rochester MN, 55901 USA http://www.mayo.edu/sppdg/

sig...@gmail.com

unread,
Mar 9, 2005, 10:25:24 AM3/9/05
to
That is about it...

Robert

sig...@gmail.com

unread,
Mar 9, 2005, 10:59:13 AM3/9/05
to
Well that is good news then...

Robert

lvi...@gmail.com

unread,
Mar 9, 2005, 1:25:48 PM3/9/05
to

According to <bbea...@desanasystems.com>:
:So, if the original poster had not been using an unsupported extension

:(not in TCLLIB) then he would not have had his email problem? Is that
:correct?
:

Trf is supported - both itself by its author, and by tcllib (the
trf author actually is one of the primary tcllib authors).


Looks like, to me, a bug fix for this problem was added to tcllib the
afternoon of March 8, probably motivated in part
on this comp.lang.tcl discussion.
--
<URL: http://wiki.tcl.tk/> MP3 ID tag repair < http://www.fixtunes.com/?C=17038 >
Even if explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
<URL: mailto:lvi...@gmail.com > <URL: http://www.purl.org/NET/lvirden/ >

0 new messages