Is both CHR(10) and CHR(13) needed in windows?

20,608

Solution 1

The email standard (RCF2822) says that lines must be separated by carriage return and line feed (aka CRLF, or chr(13)+chr(10)) no matter the source or destination platform [ie. this isn't a windows issue].

Typically CRLF is most important when seperating headers, but it further limits the length of a single line of text to no more than 998 characters, and preferably no more than 78 characters (1000,80 without the CRLF characters).

In RFC2822 Section 2.3 it further states that the body must only contain CRLF together, they must not appear independently so it's quite likely that some piece of the mail infrastructure is truncating at that first chr(10). If you wanted to include such characters in the body alone you'd need to use a different form of content encoding... base64 for example (but that's out of scope of what you're asking for - I'm not suggesting that as a solution ;))

All that said... if your above code is VBScript you should be using & to concatenate two strings together (not ||). If it's plsql script have you confirmed that the output of that statement is a large amount of text and not just the first string?

Solution 2

The email standards specify that lines should end with CR/LF (chr(13)/chr(10)). See https://www.rfc-editor.org/rfc/rfc2822#section-2.1

In general Windows text files follow the same format.

Share:
20,608
Alexandros
Author by

Alexandros

Updated on July 24, 2020

Comments

  • Alexandros
    Alexandros almost 4 years

    I have to fix a problem in an application. The application is an Oracle Form deployed to an application server. The form at the end of is process which is to press a button is suppose to send an email. At the end of the code in the button it has an PL/SQL code that calls a CMD file inside C:\ When the PL/SQL code calls the CMD file it passed 3 arguments which are string variables. I have a problem with the third.

    this is a sample of the 3rd argument:

    '** VACATION REQUEST **'||chr(10)||

            '**********************'||chr(10)||chr(10)||
    
            '** Notice: Forward this mail to [email protected]'||chr(10)||
    
          '           stating whether the request is approved or rejected'||chr(10)||chr(10)||
    
            'Request Number   : '||:peticiones_vacaciones.codigo||chr(10)||
    
            'Date of Request  : '||to_char(:peticiones_vacaciones.fecha_peticion,'dd/mm/yyyy')||chr(10)||chr(10)|| 
    

    The cmd file calls a Vbscript which creates an Outlook object and passes the third variable as an HTML body.

    The problem to all this is that when someone receives this email in the body of the email will only see the first line which is ** VACATION REQUEST ** all the other part of the body is missing.

    I found that in windows with vbscript you have to put both CHR(10) and CHR(13) at the end of a line ???

    Is that true ? Can this be the problem in my case ?