Skip to Main Content
  • Questions
  • utl_smtp send_mail: How to set importance high and get it as exclamation mark in Outlook

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Fabienne.

Asked: January 08, 2009 - 8:45 am UTC

Last updated: January 08, 2009 - 12:43 pm UTC

Version: 10g

Viewed 1000+ times

You Asked

Hello,

I am using utl_smtp to send e-mails from an oracle proc, and it works fine. I have been asked a 'nice to have': to set the Importance flag. I have used the Importance parameter in the send, but just got

Importance: High

as first line in the mail body.
What I need is the exclamation point, and nothing in the text.
Is this possible?

Here is the code extract:


                begin
                        mail_pkg.send
                        ( p_sender_email => mymail@siemens.com',
                          p_from => 'mymail@siemens.com',
                          p_to => 'hismail@siemens.com',
                      p_subject => 'the subject',
                     p_importance => 'High',
                          p_body => 'toto');
                     end;


Thansk a lot!

Fabienne

and Tom said...

sorry, I'm not an "outlook" user so I cannot test any of this for you.

that said, if you are using my "mail_pkg" code, it doesn't have an importance parameter...
tkyte@TKYTE816> create or replace package mail_pkg
  2  as
  3          type array is table of varchar2(255);
  4
  5          procedure send( p_sender_email in varchar2,
  6                          p_from         in varchar2,
  7                          p_to           in array default array(),
  8                          p_cc           in array default array(),
  9                          p_bcc          in array default array(),
 10                          p_subject      in varchar2,
 11                          p_body         in long );
 12  end;
 13  /
Package created.


so, I don't know "what" you are using or what you are doing in the code itself.

Now, if you are using a modified version of my code
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:255615160805

you would want to make sure the "importance" record is in the email header - with the date/from/subject information

 59      utl_smtp.open_data(g_mail_conn );
 60
 61      writeData( 'Date: ' || l_date );
 62      writeData( 'From: ' || nvl( p_from, p_sender_email ) );
 63      writeData( 'Subject: ' || nvl( p_subject, '(no subject)' ) );
 64
 65      writeData( l_to_list );
 66      writeData( l_cc_list );
 67
 68      utl_smtp.write_data( g_mail_conn, '' || g_crlf );
 69      utl_smtp.write_data(g_mail_conn, p_body );
 70      utl_smtp.close_data(g_mail_conn );
 71      utl_smtp.quit(g_mail_conn);
 72  end;


you'd want to have it around lines 61 of my original code. definitely before like 68 which ends the header.

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library