lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


G'Day,

> > I ran your test here. Worked fine.
> 
> 	That explains why I could not find anything wrong with it at least!
> The problem may be filesystem based or something funny like that; I will
> have to play around with anything external to the script I can find.

	I seem to be at a loss as to what the problem may be, so I am just
fishing for suggestions here.  The problem line for me seems to be the
one below:

body = ltn12.source.chain(
			  ltn12.source.file(io.open("test.txt", "r")), 
			  ltn12.filter.chain(
					     mime.encode("quoted-printable"),
					     mime.wrap()
					    )
			 )

	If I replace it with `body = "some string"' then everything works
perfectly fine --- my email client even interprets "some string" as
being an attachment.  If I leave the line as-is, however, the script
seems to hang at the part where it sends the email.  I tried looking at
the ltn12.lua file, to see what these functions do, but they did not
seem to be doing anything all that outrageous: I would have expected
they should work just as well as everything else.

	I have ruled out the filesystem as being the problem: if I do `file =
io.open("test.txt", "r")', I can use the file as I would normally expect
to.  I also tested the ltn12.source.file() function with the following
(based on the wiki example):

for chunk in ltn12.source.file(io.open("test.txt", "r")) do
	io.write(chunk)
end

	This worked fine, so I suppose it is safe to say that this part is OK.
Again, using the wiki to help, I expanded upon this:

chain = ltn12.filter.chain(mime.encode("quoted-printable"), mime.wrap())
for chunk in ltn12.source.file(io.open("test.txt", "r")) do
io.write(chain(chunk), "\n")
end

	This resulted in a slightly different output, but I assume that is what
I should expect.  At the very least, I received an output very quickly,
while my email hangs a long time and never sends.  I would have also
tested ltn12.source.chain() like this, but I was not sure how; at any
rate, I know that the input it receives should work, so I am not sure
why the script hangs on it.

	I am now stuck at this point.  Any advice on how to debug past this
would be very welcome!

	-- Matthew