Home » SQL & PL/SQL » SQL & PL/SQL » Return Receipt in Oracle Email (11g)
Return Receipt in Oracle Email [message #589521] Mon, 08 July 2013 04:07 Go to next message
sivakumar121
Messages: 27
Registered: April 2009
Junior Member
I have a requirement to use the return receipt functionality (how it exists in Microsoft Outlook emails)

I tried with UTL_SMTP - using one of the 'Return-Receipt-To: abc@example.com', It is not working though.
Rest of all features like cc, bcc works well.

Even I tried to use this with UTL_MAIL.SEND - I did not see this functionality in syntax itself.

Any help on this will be appreciated.
Re: Return Receipt in Oracle Email [message #589522 is a reply to message #589521] Mon, 08 July 2013 04:08 Go to previous messageGo to next message
Michel Cadot
Messages: 60063
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You can't.

Regards
Michel
Re: Return Receipt in Oracle Email [message #589523 is a reply to message #589522] Mon, 08 July 2013 04:13 Go to previous messageGo to next message
sivakumar121
Messages: 27
Registered: April 2009
Junior Member
That was quick - Thank you.


Re: Return Receipt in Oracle Email [message #589556 is a reply to message #589522] Mon, 08 July 2013 09:17 Go to previous messageGo to next message
Solomon Yakobson
Messages: 2089
Registered: January 2010
Senior Member
Michel Cadot wrote on Mon, 08 July 2013 05:08
You can't.


No, you can. OP should use not Return-Receipt-To but Disposition-Notification-To:

CREATE OR REPLACE
  PROCEDURE SEND_MAIL(
                      p_sender       varchar2,
                      p_recipient    varchar2,
                      p_subject      varchar2,
                      p_message      varchar2,
                      p_format       varchar2,
                      p_priority     number := 0,
                      p_read_receipt boolean := false
                     )
    IS
      v_conn utl_smtp.connection;
BEGIN
    v_conn := utl_smtp.open_connection('XXX.COM',25);
    utl_smtp.helo(v_conn,'XXX.COM');
    utl_smtp.mail(v_conn,p_sender);
    utl_smtp.rcpt(v_conn,p_recipient);
    utl_smtp.data(
                  v_conn,
                  'Date: ' || TO_CHAR(SYSDATE,'dd Mon yy hh24:mi:ss') || utl_tcp.crlf ||
                  'From: ' || p_sender || ' <' || p_sender || '>' || utl_tcp.crlf ||
                  'Subject: ' || p_subject || utl_tcp.crlf ||
                  'Content-Type: ' || p_format || utl_tcp.crlf ||
                  'X-Priority: ' || p_priority || utl_tcp.crlf ||
                  case
                    when p_read_receipt then 'Disposition-Notification-To: ' || p_sender || utl_tcp.crlf
                  end || p_message
                 );
    utl_smtp.quit(v_conn);
END;
/


SY.

[Updated on: Mon, 08 July 2013 09:20]

Report message to a moderator

Re: Return Receipt in Oracle Email [message #589560 is a reply to message #589556] Mon, 08 July 2013 09:35 Go to previous messageGo to next message
Solomon Yakobson
Messages: 2089
Registered: January 2010
Senior Member
And same can be done with UTL_TCP:

CREATE OR REPLACE
  PROCEDURE SEND_MAIL(
                      p_sender       varchar2,
                      p_recipient    varchar2,
                      p_subject      varchar2,
                      p_message      varchar2,
                      p_format       varchar2,
                      p_priority     number := 0,
                      p_read_receipt boolean := false
                     )
    IS
      v_conn utl_tcp.connection;
      v_rc   integer;
BEGIN
    v_conn := utl_tcp.open_connection(XXX.COM',25);
    dbms_output.put_line(utl_tcp.get_line(v_conn,TRUE));
    v_rc := utl_tcp.write_line(v_conn,'HELO XXX.COM');
    dbms_output.put_line(utl_tcp.get_line(v_conn,TRUE));
    v_rc := utl_tcp.write_line(v_conn,'MAIL FROM: ' || p_sender);
    dbms_output.put_line(utl_tcp.get_line(v_conn,TRUE));
    v_rc := utl_tcp.write_line(v_conn,'RCPT TO: ' || p_recipient);
    dbms_output.put_line(utl_tcp.get_line(v_conn,TRUE));
    v_rc := utl_tcp.write_line(v_conn,'DATA');
    dbms_output.put_line(utl_tcp.get_line(v_conn,TRUE));
    v_rc := utl_tcp.write_line(v_conn,'Subject: ' || p_subject);
    v_rc := utl_tcp.write_line(v_conn,'X-Priority: ' || p_priority);
    v_rc := utl_tcp.write_line(v_conn,'Content-Type: ' || p_format);
    if p_read_receipt
      then v_rc := utl_tcp.write_line(v_conn,'Disposition-Notification-To: ' || p_sender);
    end if;
    v_rc := utl_tcp.write_line(v_conn,p_message);
    v_rc := utl_tcp.write_line(v_conn,'.');
    dbms_output.put_line(utl_tcp.get_line(v_conn,TRUE));
    v_rc := utl_tcp.write_line(v_conn,'QUIT');
    dbms_output.put_line(utl_tcp.get_line(v_conn,TRUE));
    utl_tcp.close_connection(v_conn);
END;
/


SY.
Re: Return Receipt in Oracle Email [message #589561 is a reply to message #589560] Mon, 08 July 2013 10:11 Go to previous messageGo to next message
sivakumar121
Messages: 27
Registered: April 2009
Junior Member
Quickly Tested with Disposition-Notification-To: - It did worked.
Thank you so much.
Re: Return Receipt in Oracle Email [message #589563 is a reply to message #589561] Mon, 08 July 2013 10:24 Go to previous message
Michel Cadot
Messages: 60063
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Indeed thanks, it has been years that the constant answer was "it can't be done".

Regards
Michel
Previous Topic: Reading File with UL_FILE
Next Topic: PLSQL Code: Error: PLS-00487: Invalid reference to variable
Goto Forum:
  


Current Time: Sat Dec 27 14:04:09 CST 2014

Total time taken to generate the page: 0.14757 seconds