PLSQL: CHR(13)||CHR(10) DOES NOT WORK IN THE EMAIL BODY (Doc ID 1211776.1)

Last updated on AUGUST 29, 2017

Applies to:

PL/SQL - Version 10.2.0.4 and later
Information in this document applies to any platform.

Symptoms

chr(13)||chr(10) in the code block below is supposed to create a newline but is only creating a space instead.

DECLARE
mailhost VARCHAR2(64) := 'xxx.com';
sender VARCHAR2(64) := 'xxxx@oracle.com';
recipient VARCHAR2(64) := 'xxxx@oracle.com';
mail_conn UTL_SMTP.CONNECTION;
BEGIN
mail_conn := UTL_SMTP.OPEN_CONNECTION(mailhost, 25);
UTL_SMTP.HELO(mail_conn, mailhost);
UTL_SMTP.MAIL(mail_conn, sender);
UTL_SMTP.RCPT(mail_conn, recipient);

UTL_SMTP.OPEN_DATA(mail_conn);
UTL_SMTP.WRITE_DATA( mail_conn, 'Subject' || ': ' || 'subject' || utl_tcp.CRLF );
UTL_SMTP.WRITE_DATA(mail_conn, utl_tcp.CRLF || 'Date work order was released on 30-JAN-
2010'||chr(13)||chr(10)||'Date work order should be completed on 31-MAY-2010' );
UTL_SMTP.CLOSE_DATA(mail_conn);
UTL_SMTP.QUIT(mail_conn);
END;
/




Following code but DID NOT resolve the issue

  1. UTL_SMTP.WRITE_DATA(mail_conn, utl_tcp.CRLF || 'Date work order was released on 30-JAN-2010'||utl_tcp.CRLF||'Date work order should be completed on 31-MAY-2010' );

  2. UTL_SMTP.WRITE_DATA(mail_conn,'Content-Type: text/plain; charset=utf-8'||utl_tcp.CRLF);

  3. Workaround from Bug 8973284:
    alter session set events '10590 trace name context forever, level 14';  



Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms