0

I am creating HTML format for sending email in Java and using below UNIX script to send it:

(       echo "Subject: Test";
        echo "To: test@mail.com";
        echo "MIME-Version: 1.0";
        echo "Content-Type: text/html";
        echo "Content-Disposition: inline";
        echo "";
        cat HTML_Body
) | sendmail test@mail.com

But HTML_Body is getting distorted when I am receiving mails from this UNIX command, also some special characters like ! are also getting added along with the body, also the alignment of some cells are getting distorted.

When I am copying the HTML_Body from Java console, the body is created properly, but after sendmail command it is getting distorted.

I am using outlook, and Unix version is : AIX serverName 1 6

Also please suggest some other options for sending mail through UNIX or using Java. I tried creating file from Java and sending it as an attachment but, in that file also, content was getting distorted.

[Edit] Adding more details, this bug is exact the same explained here for sendmail command.

Vishrant
  • 15,456
  • 11
  • 71
  • 120

2 Answers2

1

I was also having issues with long html, some special chars were added. After I inserted a newline after every <tr>, the problem went away

Sz.
  • 3,342
  • 1
  • 30
  • 43
0

Sendmail line length limits

Sendmail as provided by sendmail.org imposes limit on line lengths (990 or 2048 bytes) and breaks longer lines.

You may
* use tool like mimencode to encode body in quoted-printable format
(requires changes in mime headers)
OR
* use tool like tidy to reformat your html file with line length limits

BTW There should be an empty line between email headers and email body (echo "").

AnFi
  • 10,493
  • 3
  • 23
  • 47