Forum Stats

  • 3,854,625 Users
  • 2,264,392 Discussions


Page URL not formatted properly to use in email?

hayatms Member Posts: 58 Blue Ribbon


I am trying to create and send URL from but seems there is some problem in the created URL,

SELECT apex_mail.get_instance_url || APEX_UTIL.PREPARE_URL(p_url => 'f?p=' || v('APP_ID') || ':13:'|| v('APP_PAGE_ID') ||'::NO::P13_ID:1') into v_PAGE_URL FROM DUAL;

  apex_mail.send (

    p_to         => '[email protected]',

    p_template_static_id => 'JOB_REQUISITION',

    p_placeholders    => '{' ||

    '  "ORDER_NUMBER":'      || apex_json.stringify( 'l_business_ref' ) ||

    '  ,"CUSTOMER_NAME":'      || apex_json.stringify( 'some_value' ) ||

    '  ,"MY_APPLICATION_LINK":'   || apex_json.stringify(v_PAGE_URL) ||

    '  ,"ORDER_URL":'        || apex_json.stringify( 'some_value' ) ||

    '}' );

No idea why pls/apex//pls/apex is duplicated in the output URL? APEX version is 21.2 and it is



  • msammour
    msammour Member Posts: 60 Bronze Badge

    Can you check what [apex_mail.get_instance_url] will return, if the returned URL is having pls/apex then you can remove it from:

    Manage Instance \ Instance Settings \ Email \ Application Express Instance URL

  • hayatms
    hayatms Member Posts: 58 Blue Ribbon


    I was looking for such options but was unable to find them in as seems instance settings can't be accessed or maybe I am missing the navigation. thanks

  • InoL
    InoL Member Posts: 10,070 Gold Crown

    This could very well be a bug with friendly URLs.

    apex_mail.get_instance_url returns

    APEX_PAGE.GET_URL or APEX_UTIL.PREPARE_URL as non-friendly URL returns f?p=...

    So, if you combine these two, it works as expected.

  • hayatms
    hayatms Member Posts: 58 Blue Ribbon
    I tried all these options but these both are prefixing /pls/apex which is causing problem. I tried 
                p_page   => 1,
                p_items  => 'P1_X,P1_Y',
                p_values => 'somevalue,othervalue' ) f_url_1,
         FROM DUAL

    When I am trying following in SQL using SQL Commands then URL is correct but same code when I am trying in APEX form using processes or pl_sql having the problem,

    SELECT apex_mail.get_instance_url || APEX_PAGE.GET_URL (p_page  => 13, p_items => 'P13_ID',p_values => 1 ) 


    I need to send this URL in email so the user will click to open the form. Any suggestions please to get resolved on

  • msammour
    msammour Member Posts: 60 Bronze Badge

    If you cannot access the internal admin console you cannot do it, [APEX_PAGE.GET_URL, and APEX_UTIL.PREPARE_URL] will always return the full path.

    For your case you can add <a href=""> in your email body and the href source will be something like:

    SELECT APEX_MAIL.GET_INSTANCE_URL || 'f?p=' || V('APP_ID') || ':13:' || V('APP_PAGE_ID') ||
    FROM   DUAL;