title: Oracle PL/SQL send HTML mail does not behave as expected
body: <p>I am trying to send mail using Oracles UTL_SMTP. It works, but I get weird behaviour and I don't know why. When I send mail using my code below HTML code is printed with all the tags. Another problem, header information such as the sender and content type is also printed. I have been looking at this code for couple of hours now, but failed to figure out what the problem is.</p>
  
  <p>Please Help!</p>
  
  <pre><code>  l_mail_conn UTL_SMTP.connection;
    l_mail_conn := UTL_SMTP.open_connection('myhost', '25');
    UTL_SMTP.helo(l_mail_conn, 'myhost');
    UTL_SMTP.mail(l_mail_conn, 'noreply@myhost.com');
    UTL_SMTP.rcpt(l_mail_conn, 'test@gmail.com');
  
    UTL_SMTP.open_data(l_mail_conn);
    UTL_SMTP.write_data(l_mail_conn, 'Date: ' || TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS') || UTL_TCP.crlf);
    UTL_SMTP.write_data(l_mail_conn, 'To: test@gmail.com' || UTL_TCP.crlf);
    UTL_SMTP.write_data(l_mail_conn, 'From: noreply@myhost.com'|| UTL_TCP.crlf);
    UTL_SMTP.write_data(l_mail_conn, 'Subject: test' || UTL_TCP.crlf);
    UTL_SMTP.write_data(l_mail_conn, 'Reply-To: sales@myhost.ie' || UTL_TCP.crlf || UTL_TCP.crlf);
  
      UTL_SMTP.write_data(l_mail_conn, 'Content-Type: text/html; charset="iso-8859-1"' || UTL_TCP.crlf || UTL_TCP.crlf);
      UTL_SMTP.write_data(l_mail_conn, '&lt;html&gt;
      &lt;head&gt;
        &lt;title&gt;Test HTML message&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
        &lt;p&gt;This is a &lt;b&gt;HTML&lt;/b&gt; &lt;i&gt;version&lt;/i&gt; of the test message.&lt;/p&gt;
        &lt;p&gt;&lt;img src="http://oracle-base.com/images/site_logo.gif" alt="Site Logo" /&gt;
      &lt;/body&gt;
    &lt;/html&gt;');
      UTL_SMTP.write_data(l_mail_conn, UTL_TCP.crlf || UTL_TCP.crlf);
  
    UTL_SMTP.close_data(l_mail_conn);
  
    UTL_SMTP.quit(l_mail_conn);
  </code></pre>
  
  <p>And this is the e-mail I get when I send mail using this code:</p>
  
  <pre><code>Content-Type: text/html; charset="iso-8859-1"
  
  &lt;html&gt;
      &lt;head&gt;
        &lt;title&gt;Test HTML message&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
        &lt;p&gt;This is a &lt;b&gt;HTML&lt;/b&gt; &lt;i&gt;version&lt;/i&gt; of the test message.&lt;/p&gt;
        &lt;p&gt;&lt;img src="http://oracle-base.com/images/site_logo.gif" alt="Site Logo" /&gt;
      &lt;/body&gt;
    &lt;/html&gt;
  </code></pre>