Skip to main content
Solved

Command_SYS.Mail - new line


Forum|alt.badge.img+10
  • Hero (Customer)
  • 96 replies

Hi Experts,

I am using Command_SYS.Mail() function in Execute Online SQL to send a notification mail via custom event to users.

How can I add a new line in my variable (sending text)  without using ‘HTML’ CONTENT  TYPE ?

 

Thanks a lot for your help

Best answer by Charith Epitawatta

Hi @NMALKI,

If the content type is text/plain in Mail Sender configuration, then the linefeed character is chr(13). Oracle interprets this into ‘\n’ new line character. You can structure your email message as below:

Eg:

BEGIN
command_sys.mail('','example@email.com','Line1'||chr(13)||'Line2');
END; 

If the content type is text/html, then you can use the <br> HTML tag.

Eg:

BEGIN
command_sys.mail('','example@email.com','Line1<br>Line2');
END; 

Hope this helps!

View original
Did this topic help you find an answer to your question?
This topic has been closed for replies.

4 replies

Charith Epitawatta
Ultimate Hero (Employee)
Forum|alt.badge.img+31

Hi @NMALKI,

If the content type is text/plain in Mail Sender configuration, then the linefeed character is chr(13). Oracle interprets this into ‘\n’ new line character. You can structure your email message as below:

Eg:

BEGIN
command_sys.mail('','example@email.com','Line1'||chr(13)||'Line2');
END; 

If the content type is text/html, then you can use the <br> HTML tag.

Eg:

BEGIN
command_sys.mail('','example@email.com','Line1<br>Line2');
END; 

Hope this helps!


Imal Thiunuwan
Superhero (Employee)
Forum|alt.badge.img+16
  • Superhero (Employee)
  • 117 replies
  • June 22, 2021

Hello @NMALKI ,

If you set up your mail_sender with content-type : text/plain, as @Charith Epitawatta mentioned you will be able to use chr(13) character  to add a new line to the email body without using <br> tag . If you really want to use this setting, then you'll lose any markup (HTML). Please refer the attached screen shot from one of our test environments for further clarification.

Try to setup like this way to use chr(13) characters in your email body. In Oracle \n character is not supported to add new lines.

Cheers!


Forum|alt.badge.img+10
  • Author
  • Hero (Customer)
  • 96 replies
  • June 22, 2021

Thanks everyone for your help 


durette
Superhero (Customer)
Forum|alt.badge.img+19
  • Superhero (Customer)
  • 537 replies
  • June 24, 2021

A standards-compliant email message would use both a carriage return and a line feed to represent a new line.

'Line 1' || CHR(13) || CHR(10) || 'Line 2'
/*
CR = 13
LF = 10
*/

 

  • Windows uses CR+LF, as does the specification for emails.
  • UNIX and UNIX-like operating systems use LF (e.g. AIX, Solaris, HP-UX, Linux, Mac OS X, Android, FreeBSD, Minix)
  • Mac OS 9 used CR.

 

In the bad old days, if you sent a UNIX-style LF, email servers written to the letter of the RFC spec would complain of a “naked line feed”.

 

However, even if you take care to do this correctly, Microsoft Outlook might still remove them:

Line breaks are removed in posts made in plain text format - Outlook | Microsoft Docs

 

Table from asciitable.com:

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings