If the email arrives but you just can't see the message itself, it would be a good idea to send an empty line after the headers:

...
sockwrite -n $sockname Subject: %mail.subject
sockwrite -n $sockname
...