Forum Stats

  • 3,854,617 Users
  • 2,264,391 Discussions
  • 7,905,743 Comments

Discussions

APEX_UTIL.RESET_PW - Email Message Formatting

aschultz
aschultz Member Posts: 2
edited Nov 16, 2015 5:50AM in APEX Discussions

Hi

I am currently using a PL/SQL process to call a procedure that uses APEX_UTIL.RESET_PW to reset user passwords.  Though I've been able to customize the email message in some sense, I can't seem to find the answer for defining the subject line, to field, from field, and how to edit the default body email content that ships with it.


For my code example, I'm using:

l_body :='Hi

A password reset request has been submitted for your account.

Please login to your account with this temporary password.  After you login, you will be prompted to change your password.  If the password reset request was not made by you, please contact us immediately so we can address the issue.

Thank you,

Bob

If you would like to unsubscribe, please click on the link below:

%%UNSUBSCRIBE%%      ';

APEX_UTIL.RESET_PW('SCHULTZ', l_body);


However the email message contains the subject line of:  Password Reset Notification

and the message body of:


Hi

A password reset request has been submitted for your account.

Please login to your account with this temporary password.  After you login, you will be prompted to change your password.  If the password reset request was not made by you, please contact us immediately so we can address the issue.

Thank you,

Bob

If you would like to unsubscribe, please click on the link below:

(unsubscribe link)

Username:  SCHULTZ

Password:  93hdU6

1.)  How should I go about changing the subject line to something less generic?  For example:  Password Reset Notification for X System on '|| Sysdate ||'


2.)  How can I move the username and password information around in my email body so that it doesn't appear at the way bottom of the email?  For example:

Hi

A password reset request has been submitted for your account.

Please login to your account with this temporary password.:

Username:  SCHULTZ

Password:  93hdU6

After you login, you will be prompted to change your password.  If the password reset request was not made by you, please contact us immediately so we can address the issue.

Thank you,

Bob

If you would like to unsubscribe, please click on the link below:

(unsubscribe link)

3.)  Is there anyway to make the temporary password longer than 6 characters?



Thank you so much Oracle Apex Forum

~Andrew




Tagged:

Answers

  • Mahmoud_Rabie
    Mahmoud_Rabie Cloud Solution Architect, Member Posts: 3,216 Bronze Crown
    edited Nov 15, 2015 5:56AM

    Hi aschltz,

    You could from your PL/SQL using UTL_SMTP to send formatted email. Please check the following

    https://oracle-base.com/articles/misc/email-from-oracle-plsql#html

    and this also

    Sending formatted email

    Regards

    Mahmoud

  • Jozef Demovic SVK
    Jozef Demovic SVK Member Posts: 426 Silver Badge
    edited Nov 16, 2015 2:48AM

    Hi,

    I am not sure if there is no restriction for msg text length. I use formatted email for reset pwd but i use just a short description. I think that it is right due to length restriction.

    Is there some closer description for APEX_UTIL.RESET_PW procedure ? I can't find it.

    Regards

    J

  • aschultz
    aschultz Member Posts: 2
    edited Nov 16, 2015 4:36AM

    Hi Mahmoud and Jozef

    The procedure document for APEX_UTIL.RESET.PW can be found here:
    http://docs.oracle.com/cd/E14373_01/apirefs.32/e13369/apex_util.htm#AEAPI171

    APEX_UTIL.RESET_PW(

      p_user IN VARCHAR2,

      p_msg IN VARCHAR2);

    Out of curiosity, are you doing your own custom password reset procedure or have you ever used APEX_UTIL.RESET_PW?  Is something custom the recommended course of action for password resets?


    For other information purposes:

    APEX 5.x

    Oracle 11g

    Application Express Authentication

    As far as the message part for APEX_UTIL.RESET_PW is concerned, I have not figured out what the substitution strings that ship with p_msg are.  Once I know that, then I can place them where I want them to go in my message.  I have also not figured out a way to call the procedure and use APEX_MAIL.SEND to create my own subject line like:


    APEX_MAIL.SEND(

            p_to    =>  '[email protected]'

            p_from    =>  '[email protected]'

            p_body    => l_body,

            p_subj    => 'Password Reset Request for X System '|| to_char(sysdate, 'MM-DD-YYYY') ||' ');

    END;

    APEX_MAIL.PUSH_QUEUE;

    Thank you

    ~Andrew

  • Mahmoud_Rabie
    Mahmoud_Rabie Cloud Solution Architect, Member Posts: 3,216 Bronze Crown
    edited Nov 16, 2015 5:50AM

    Hi aschultz

    Please read this

    https://docs.oracle.com/cd/E37097_01/doc.42/e35127/apex_mail.htm#AEAPI342

    The following example demonstrates how to use APEX_MAIL.SEND to send an HTML email message from an application. Remember, you must include a carriage return or line feed (CRLF) every 1000 characters. The example that follows uses utl_tcp.crlf.
    
    
    
    
    
    
    -- Example Two: Plain Text / HTML message
    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.'||utl_tcp.crlf;
    
      l_body_html := '<html>
      <head>
      <style type="text/css">
      body{font-family: Arial, Helvetica, sans-serif;
      font-size:10pt;
      margin:30px;
      background-color:#ffffff;}
    
      span.sig{font-style:italic;
      font-weight:bold;
      color:#811919;}
      </style>
      </head>
      <body>'||utl_tcp.crlf;
      l_body_html := l_body_html ||'<p>Thank you for your interest in the <strong>APEX_MAIL</strong> package.</p>'||utl_tcp.crlf;
      l_body_html := l_body_html ||' Sincerely,<br />'||utl_tcp.crlf;
      l_body_html := l_body_html ||' <span class="sig">The Application Express Dev Team</span><br />'||utl_tcp.crlf;
      l_body_html := l_body_html ||'</body></html>';
      apex_mail.send(
      p_to => '[email protected]', -- change to your email address
      p_from => '[email protected]', -- change to a real senders email address
      p_body => l_body,
      p_body_html => l_body_html,
      p_subj => 'APEX_MAIL Package - HTML formatted message');
    END;
    /
    
    

    Regards

    Mahmoud

This discussion has been closed.