create or replace package mip_email is

  -- Author  : MULLENMD
  -- Created : 02/11/2007 13:46:43
  -- Purpose : Allow the system to send emails.
  
  g_from_address CONSTANT VARCHAR2(50) := cout_system_configuration.get_configuration_item('EMAIL_FROM_ADDRESS');

  PROCEDURE send_email_plain_text(p_recipient IN VARCHAR2,
                       p_from IN VARCHAR2 DEFAULT g_from_address,
                       p_body IN VARCHAR2,
                       p_subject IN VARCHAR2);

  PROCEDURE send_email_vchar(p_recipient IN VARCHAR2,
                       p_from IN VARCHAR2 DEFAULT g_from_address,
                       p_body IN VARCHAR2,
                       p_body_html IN VARCHAR2,
                       p_subject IN VARCHAR2);
                     
  PROCEDURE send_email_clob(p_recipient IN VARCHAR2,
                            p_from IN VARCHAR2 DEFAULT g_from_address,
                            p_body IN CLOB,
                            p_body_html IN CLOB,
                            p_subject IN VARCHAR2);
                     
end mip_email;
/
create or replace package body mip_email is
   
  --
  PROCEDURE send_email_plain_text(p_recipient IN VARCHAR2,
                       p_from IN VARCHAR2 DEFAULT g_from_address,
                       p_body IN VARCHAR2,
                       p_subject IN VARCHAR2) IS
  
  BEGIN
    apex_mail.send(p_to => p_RECIPIENT,
                   p_from => p_from,
                   p_body => p_body,
                   p_subj => p_subject);
  END send_email_plain_text;
  --
  
  --
  PROCEDURE send_email_vchar(p_recipient IN VARCHAR2,
                        p_from IN VARCHAR2 DEFAULT g_from_address,
                        p_body IN VARCHAR2,
                        p_body_html IN VARCHAR2,
                        p_subject IN VARCHAR2) IS
  
  BEGIN
    apex_mail.send(p_to => p_recipient,
                 p_from => p_from,
                 p_body => p_body,
                 p_body_html => p_body_html,
                 p_subj => p_subject);
  END send_email_vchar;
  --
  
  --
  PROCEDURE send_email_clob(p_recipient IN VARCHAR2,
                        p_from IN VARCHAR2 DEFAULT g_from_address,
                        p_body IN CLOB,
                        p_body_html IN CLOB,
                        p_subject IN VARCHAR2) IS
  
  BEGIN
    apex_mail.send(p_to => p_recipient,
                 p_from => p_from,
                 p_body => p_body,
                 p_body_html => p_body_html,
                 p_subj => p_subject);
  END send_email_clob;
  --
end mip_email;
/
