I decided to try TMail for the back end of a new contact page on a
website of mine. Unfortunately, it doesn’t seem to want to work with
me.
If I don’t include a line like:
puts “Content-Type: text/html\n\n”
or like:
puts “Content-Type: text/plain\n\n”
. . . it fails with a 500 error in the browser.
If that line comes after this line:
require ‘tmail’
. . . I get the same 500 error.
If I put it before the require ‘tmail’ line, however, I get a blank page
with no error messages, but no email gets sent.
If I run the script from the shell (logged in on the server), it sends
email just fine, regardless of whether that puts line is before or after
the require ‘tmail’ line. Using print instead of puts doesn’t seem to
make any difference, either.
Even if I have the puts line before the require ‘tmail’ line, no puts
lines after the require line give me any output in the browser. If I
add
another puts line after the first, before the require line, it’ll print
whatever I tell it to in the browser, though.
So, basically, the script just seems to be broken from the moment I
require the TMail library, but it breaks “silently” so I don’t get any
errors – but everything up to that point seems to work just fine
(including other require statements, before or after the content type
line).
What am I doing wrong?