You are here: Foswiki>Service Web>SetupCommons (08 Dec 2016, SebastianMueller)Edit Attach
-- SebastianMueller - 28 Oct 2016

Setup sending E-Mail

This setup will configure the E-Mail sending in the commons schema.

This is important, for debugging jobs, database and some other notifications.

First, in the body from the COM_NOTIFIER search for 'c_smtp_server' and replace the CERN-server with this serer 'vml00a.acc.gsi.de'

The next step is to add a recipient (with your own address)

com_notifier.register_recipient (
i_recipient_name => 'Max Musterman'
, i_recipient_email => 'm_Muster@gsi.de'
, i_recipient_sms_number => ''
, i_recipient_is_admin => 'Y'
);

The admin field is important for the notifications. Some errors-notifications send always the admins an E-Mail.

After this we test this insert, with the com_notifier.

declare

l_recipients com_notifier.table_of_recipients;

begin
select *
bulk collect into l_recipients
from com_recipients cr
where cr.recipient_name = 'Max Musterman';

COM_NOTIFIER.NOTIFY_WITH_CLOB(l_recipients , 'TEST','TESTING');
end;

The mail should be receive.

The next step is to setup the notification which the recipient want to receive.

In the table COM_EVENT_DEFINATION is the name of the events. Per example the Event_name 'INIT_FAILED' is taken.

begin

for rec in (
select recipient_id
from com_recipients
where recipient_name like 'MAX%'
) loop
begin
-- Register a notification with SMS enabled to these recipients whenever the
-- FAILED_MANAGE_PARTITION event occurs.
com_event_mgr.register_event_notification('INIT_FAILED', rec.recipient_id, 'Y');
exception
when others then
-- If the recipient is already registered for this event, just ignore the exception, otherwise raise it
if not com_event_mgr.event_equals('RECIPIENT_OF_EVENT_EXISTS', sqlcode) then
raise;
end if;
end;

end loop;

commit;
end;

After this update the recipients receive a mail when an error raises.
Topic revision: r2 - 08 Dec 2016, SebastianMueller
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback