title: How do I send e-mails through Oracle DBMS_SCHEDULER?
body: <p>I'm having difficulty sending email notifications through DBMS_SCHEDULER.</p>
  
  <p>I've gone through instructions <a href="http://docs.oracle.com/cd/E18283_01/server.112/e17120/scheduse008.htm#CIAIEJEJ" rel="nofollow">here</a> on adding email notifications and <a href="http://docs.oracle.com/cd/E18283_01/server.112/e17120/schedadmin001.htm#CHDCCDFD" rel="nofollow">here</a> on configuring the mail server but I still don't get any e-mails sent. I'm using the same mail server settings on UTL_MAIL (to send mail using procedures) and Oracle Enterprise Manager (To get backup and availability email and they work fine.) I would rather not use UTL_MAIL instead as it doesn't offer the simplicity and flexibility I'm hoping to achieve with scheduler emails.</p>
  
  <p>Below we have what server settings I've configured and how I'm trying to create a job that will send notifications.</p>
  
  <pre><code>/*Settings*/
  
  exec  dbms_scheduler.set_scheduler_attribute('email_server','xxx');
  
  exec  dbms_scheduler.set_scheduler_attribute('email_sender','Scheduler@domain.com');
  
  /* Dont think this is needed but added anyway, this allows UTL_MAIL to work*/
  
  alter system set smtp_out_server = 'xxx';
  begin
    dbms_network_acl_admin.create_acl (
      acl         =&gt; 'dbms_scheduler.xml',
      description =&gt; 'Allow mail to be send',
      principal   =&gt; 'SCHEMA',
      is_grant    =&gt; TRUE,
      privilege   =&gt; 'connect'
      );
      commit;
  end;
  
  begin
    dbms_network_acl_admin.add_privilege (
    acl       =&gt; 'dbms_scheduler.xml',
    principal =&gt; 'SCHEMA',
    is_grant  =&gt; TRUE,
    privilege =&gt; 'resolve'
    );
    commit;
  end;
  
  begin
    dbms_network_acl_admin.assign_acl(
    acl  =&gt; 'dbms_scheduler.xml',
    host =&gt; 'xxx'
    );
    commit;
  end;
  
  /*Create a quick, simple job*/
  
  BEGIN
      DBMS_SCHEDULER.CREATE_JOB (
              job_name =&gt; '"SCHEMA"."EMAIL_TEST"',
              job_type =&gt; 'STORED_PROCEDURE',
              job_action =&gt; 'SCHEMA.DO_MOD',
              number_of_arguments =&gt; 0,
              start_date =&gt; NULL,
              repeat_interval =&gt; NULL,
              end_date =&gt; NULL,
              enabled =&gt; FALSE,
              auto_drop =&gt; FALSE,
              comments =&gt; '');
  
      DBMS_SCHEDULER.SET_ATTRIBUTE( 
               name =&gt; '"SCHEMA"."EMAIL_TEST"', 
               attribute =&gt; 'restartable', value =&gt; TRUE);
  
  
      DBMS_SCHEDULER.SET_ATTRIBUTE( 
               name =&gt; '"SCHEMA"."EMAIL_TEST"', 
               attribute =&gt; 'logging_level', value =&gt; DBMS_SCHEDULER.LOGGING_RUNS);
      DBMS_SCHEDULER.SET_ATTRIBUTE( 
               name =&gt; '"SCHEMA"."EMAIL_TEST"', 
               attribute =&gt; 'raise_events', value =&gt; '511');
      DBMS_SCHEDULER.ADD_JOB_EMAIL_NOTIFICATION (    
               job_name =&gt; '"SCHEMA"."EMAIL_TEST"', 
               recipients =&gt; 'user@xxx',
               sender =&gt; 'oracle@xxx',
               subject =&gt; 'Oracle Scheduler Job Notification - %job_owner%.%job_name%.%job_subname% %event_type%',
               body =&gt; 'Job: %job_owner%.%job_name%.%job_subname%
  Event: %event_type%
  Date: %event_timestamp%
  Log id: %log_id%
  Job class: %job_class_name%
  Run count: %run_count%
  Failure count: %failure_count%
  Retry count: %retry_count%
  Error code: %error_code
  %Error message: %error_message%',
               events =&gt; 'job_started, job_broken, job_chain_stalled, job_completed, job_disabled, job_failed, job_over_max_dur, job_run_completed, job_sch_lim_reached, job_stopped, job_succeeded',
                  filter_condition =&gt; NULL 
               );
      DBMS_SCHEDULER.enable(
               name =&gt; '"SCHEMA"."EMAIL_TEST"');
  END;
  </code></pre>
  
  <p>This code all completes successfully but I get no emails. I can also see the entries in user_scheduler_notifications but receive nothing.</p>