in reply to baffled by the sendmail..

It would help immensely if you could provide the data the SMTP server is sending in response. (Reading from SMTP should work.) You aren't getting any errors because your script is functioning perfectly (well, almost; see below). The SMTP server is probably returning errors, however, but your script isn't reading any data from the socket, only sending it, so you'll never know.

With respects to the newline thing, it may be simplest to just set, say, $/ = "\r\n"; and terminate your lines with $/ instead. To be honest, most MTA's tend to not care whether you use \n or \r\n.

In addition, you may wish to spit out To: and From: headers in addition to your Subject: header. The MAIL FROM/RCPT TO stuff isn't really seen in the message itself.