Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

UTL_MAIL.send called via DBMS_JOB.submit is not sending email

MeRookieDec 21 2015 — edited Dec 22 2015

Hi All,

I have below a procedure in the package using UTL_MAIL.send to send email. This procedure runs fine ( send email successfully ) when executed from SQL Plus like EXEC email_jobs.send_email;


This procedure is not working when I try to run using DBMS_JOB.submit. Job is getting submitted, any code other call to UTL_MAIL.send  is getting executed as well but job is not sending any email.


I cannot think of any reason.

Here is test package and calls to the procedure.

Thanks in advance.

snaseer

----------------------------------------------------------------------------------------------------------------

CREATE OR REPLACE Package   email_jobs AUTHID CURRENT_USER IS

PROCEDURE send_email;

End;

/

CREATE OR REPLACE Package Body      email_jobs IS

PROCEDURE send_email is

Begin

  UTL_MAIL.send (

  sender => 'your email',

  recipients => 'my email',

  subject => 'Test Subject',

  message => 'Test Message....'||TO_CHAR(SYSDATE, 'DD-MON-YY HH24:MI:SS'),

  mime_type => 'text; charset=us-ascii'

  );

End;

-------

END;

/

----------------------------------------------------------------------------------------------------------------

directly call

exec email_jobs.send_email;

call via submit job.

declare

  vJobNumber NUMBER;

Begin

sys.DBMS_JOB.submit ( JOB => vJobNumber,

  WHAT => 'email_jobs.send_email;',

  NEXT_DATE => SYSDATE,

  INTERVAL => 'TRUNC(SYSDATE + ((1/2)/144), ''MI'')'

  );

commit;

End;

/

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 19 2016
Added on Dec 21 2015
6 comments
1,593 views