Friday, April 24, 2015

Sending email from APEX using APEX_MAIL

To send an email using APEX you can use APEX_MAIL.SEND and APEX_MAIL.PUSH_QUEUE apis

declare
    l_body      clob;
    l_body_html clob;
begin
    l_body := 'To view the content of this message, please use an HTML enabled mail client.' ;
    l_body_html := '<html><body><p> This is test email </p> </body></html>';
    APEX_MAIL.SEND (
        p_to        => 'fromemail@email.com',   -- change to your email address
        p_from      => 'toemail@email.com', -- change to a real senders email address
        p_body      => l_body,
        p_body_html => l_body_html,
        p_subj      => 'My subject' );

    APEX_MAIL.PUSH_QUEUE;


end;