Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9181433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:18:46+00:00 2026-06-17T18:18:46+00:00

I have problems regarding a mail body formatting I’m sending: Here is the KO

  • 0

I have problems regarding a mail body formatting I’m sending:

Here is the KO version (no new lines):

declare
  crlf                     VARCHAR2(2) := chr(13)||chr(10); 
  msg_body                 VARCHAR2(2000);
begin
  msg_body := msg_body || ('Blablah  : '|| SYSTIMESTAMP ) || crlf;
  msg_body := msg_body || ('Blablah  : '|| SYSTIMESTAMP ) || crlf;
  EXECUTE IMMEDIATE 'ALTER SESSION SET smtp_out_server = ''127.0.0.1''';
  UTL_MAIL.send(sender => 'xx@xx.com', recipients => 'yy@yy.com', subject => 'Blah', MESSAGE => msg_body);
end;

Here is the OK version (nice new lines):

declare
  crlf                     VARCHAR2(2) := chr(13)||chr(10);
  msg_body                 VARCHAR2(2000);
begin
  msg_body := msg_body || ('Blablah  : ') || crlf;
  msg_body := msg_body || ('Blablah  : ') || crlf;
  EXECUTE IMMEDIATE 'ALTER SESSION SET smtp_out_server = ''127.0.0.1''';
  UTL_MAIL.send(sender => 'xx@xx.com', recipients => 'yy@yy.com', subject => 'Blah', MESSAGE => msg_body);
end;

Best regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:18:47+00:00Added an answer on June 17, 2026 at 6:18 pm

    The only difference between your two versions is the exclusion of SYSTIMESTAMP in the one that works.

    You’re not explicitly converting your SYSTIMESTAMP to a character using TO_CHAR(). It will be being implicitly converted according to your NLS_DATE_FORMAT instead.

    Convert it to a character correctly, using whatever format model you wish; for instance

    to_char(systimestamp, 'yyyy-mm-dd hh24:mi:ss:ff3')
    

    ff is fractional seconds.

    To quote

    Oracle recommends that you specify explicit conversions, rather than rely on implicit or automatic conversions, for these reasons:

    • SQL statements are easier to understand when you use explicit data type conversion functions.

    • Implicit data type conversion can have a negative impact on performance, especially if the data type of a column value is converted to that of a constant rather than the other way around.

    • Implicit conversion depends on the context in which it occurs and may not work the same way in every case. For example, implicit conversion from a datetime value to a VARCHAR2 value may return an unexpected year depending on the value of the NLS_DATE_FORMAT
      parameter.

    • Algorithms for implicit conversion are subject to change across software releases and among Oracle products. Behavior of explicit conversions is more predictable.


    I would recommend investigating using UTL_SMTP instead of UTL_MAIL. You don’t need to alter the session. A really simple send procedure might look like this:

    declare
    
       l_to_list  long;
       l_crlf varchar2(2) := chr(13) || chr(10);
       l_conn utl_smtp.connection;
       l_date     varchar2(255) default to_char(sysdate, 'dd Mon yyyy hh24:mi:ss');
    
    begin
    
       l_conn := utl_smtp.open_connection(<mailhost>, 25);
       utl_smtp.helo(l_conn, <mailhost>);
       utl_smtp.mail(l_conn, <sender>);
    
       l_to_list := address_email('To: ', <recipients>);
    
       utl_smtp.open_data(l_conn);
    
       utl_smtp.write_data('Date: ' || l_date);
       utl_smtp.write_data('From: ' || <sender>);
       utl_smtp.write_data('Subject: ' || nvl(<subject>, '(No Subject)'));
       utl_smtp.write_data('X-Mailer: ' || <mailer_id>);
    
       utl_smtp.write_data(l_to_list);
    
       utl_smtp.write_data(l_conn, '' || l_crlf);
       utl_smtp.write_data(l_conn, <msg>);
       utl_smtp.close_data(l_conn);
       utl_smtp.quit(l_conn);
    
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problems regarding with pagination and Ajax form. Here is my code for
I am new to jQueryMobile. I have one problem regarding fixed headers. I have
I have a simple problem regarding a loop in a Rails controller. Here's the
I have some problems, meaning that I don't receive mail from a form... the
I have some problems regarding WMI scripting on Windows 8. More precisely, remote connection
Some days back i had few problems regarding the version updates from iOS 4.0
I have some understanding problems regarding the stringstream . Example: stringstream stream(commands); while (true)
I have problems regarding the output of the XMLReader , which should be able
I have som problems regarding getting javascript to fire correctly inside dialog. Below is
I have a few problems regarding a custom allocator for an unordered_map. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.