SMTP charset to convert hex CR and LF


I’m reading a text file into the body of an email using getfile and passing the results to smtp body. My text file contains some Hex carriage returns (0A) and line feeds (0D) but when I send my email using charset = text/plain it just shows a continuous string with the 0A and 0D’s. How can I format plain text using smtp? I don’t want to send html formatted emails as some of our clients can’t receive these. Any help would be appreciated.



This may be a charset/encoding issue. Try setting the charset input to ISO-8859-1 on the pub.client:smtp call.


I tried this and it made no difference. Should I be passing the body text as a string or bytes?


The body should be passed as a string. You’ll likely get an exception thrown otherwise.

What is the order of the hex chars in the file? From your description, it sounds like maybe the order is 0A 0D?

Try setting the ISO-8859-1 on the bytesToString service when loading your file from disk.