Solved

Command_SYS.Mail - new line

  • 22 June 2021
  • 4 replies
  • 139 views

Userlevel 4
Badge +8

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

icon

Best answer by Charith Epitawatta 22 June 2021, 09:12

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

4 replies

Userlevel 7
Badge +12

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!

Userlevel 6
Badge +11

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!

Userlevel 4
Badge +8

Thanks everyone for your help 

Userlevel 7
Badge +15

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:

 

Reply