How send failed session to mail in doi 11g
In Oracle Forms and Reports 11g, you can send a failed session to an email using the FND_MAIL
package. Here are the steps:
Prerequisites:
-
Make sure you have the
FND_MAIL
package installed and configured in your Oracle Forms and Reports 11g environment. -
Create a mail server profile in the
FND_MAIL
package. You can do this by running the following command in SQL*Plus:BEGIN FND_MAIL.create_profile('your_mail_server_profile_name', 'your_mail_server_host', 'your_mail_server_port', 'your_mail_server_username', 'your_mail_server_password'); END; /
Sending a failed session to email:
-
In your Oracle Forms and Reports 11g application, create a trigger that will be executed when a session fails. For example, you can create a trigger on the
FORMS_SESSION
table:CREATE OR REPLACE TRIGGER trg_send_failed_session_to_email AFTER INSERT ON forms_session FOR EACH ROW BEGIN IF :NEW.status = 'FAILED' THEN FND_MAIL.send( p_to => '[email protected]', p_subject => 'Failed Session', p_message => 'Session failed with error: ' || :NEW.error_message ); END IF; END; /
This trigger will send an email to the specified recipient when a session fails.
Configuring the mail server:
- In the
FND_MAIL
package, you need to configure the mail server profile that you created earlier. You can do this by running the following command in SQL*Plus:BEGIN FND_MAIL.set_profile('your_mail_server_profile_name'); END; /
This will set the mail server profile as the default profile for sending emails.
Testing the trigger:
- Test the trigger by simulating a failed session in your Oracle Forms and Reports 11g application. For example, you can insert a row into the
FORMS_SESSION
table with a status of 'FAILED':INSERT INTO forms_session (status, error_message) VALUES ('FAILED', 'Test error message');
This should trigger the
trg_send_failed_session_to_email
trigger and send an email to the specified recipient with the error message.
Note: Make sure to replace the placeholders (your_mail_server_profile_name
, your_mail_server_host
, your_mail_server_port
, your_mail_server_username
, your_mail_server_password
, and [email protected]
) with your actual mail server settings and email address.