Home » SQL & PL/SQL » SQL & PL/SQL » inserting carriage return in an email
inserting carriage return in an email [message #200647] Tue, 31 October 2006 12:42 Go to next message
madchaz
Messages: 65
Registered: October 2005
Member
Hi all,
I'm using the smtp_utl functions to send an email in a pl/sql package.

however, I'm having a bit of an issue.

email_text := 'first part of the text'|| utl_tcp.crlf ;
email_text := email_text || 'second part of the text';


This should, in theory, put the second part of the text in a second line. However, it doesn't when I use email_text as my body field.

[Updated on: Tue, 31 October 2006 12:43]

Report message to a moderator

Re: inserting carriage return in an email [message #200649 is a reply to message #200647] Tue, 31 October 2006 13:00 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
>email_text := 'first part of the text'|| utl_tcp.crlf ;
email_text := 'first part of the text'|| CHR(10);
Re: inserting carriage return in an email [message #200655 is a reply to message #200647] Tue, 31 October 2006 14:13 Go to previous messageGo to next message
madchaz
Messages: 65
Registered: October 2005
Member
I have tried this and I get the same results.

Same with chr(13)
Re: inserting carriage return in an email [message #200656 is a reply to message #200655] Tue, 31 October 2006 14:31 Go to previous messageGo to next message
Frank Naude
Messages: 4502
Registered: April 1998
Senior Member
What MIME Content-Type are you using? If HTML, you should rather use:

email_text := 'first part of the text<BR>';
Re: inserting carriage return in an email [message #200658 is a reply to message #200647] Tue, 31 October 2006 14:45 Go to previous messageGo to next message
madchaz
Messages: 65
Registered: October 2005
Member
I'm using plain text. HTML would be too easy ...

[Updated on: Tue, 31 October 2006 14:52]

Report message to a moderator

Re: inserting carriage return in an email [message #200659 is a reply to message #200658] Tue, 31 October 2006 15:41 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Just to make it clear: you tried CHR(10), but didn't work?

This is how it works in SQL (actually, rewritten Anacedent's advice):
SQL> select 'first part of the text' || chr(10) ||
  2         'second part of the text'
  3  from dual;

'FIRSTPARTOFTHETEXT'||CHR(10)||'SECONDPARTOFTH
----------------------------------------------
first part of the text
second part of the text


SQL>
Re: inserting carriage return in an email [message #200660 is a reply to message #200659] Tue, 31 October 2006 15:42 Go to previous message
madchaz
Messages: 65
Registered: October 2005
Member
Yes, I did.

When I get the email, the text is still all on one line.
Previous Topic: How do you read and print a BLOB field when doing a file upload
Next Topic: Trigger question
Goto Forum:
  


Current Time: Fri Dec 02 18:34:00 CST 2016

Total time taken to generate the page: 0.23371 seconds