Scheduling a Mail Sending Job within Enterprise Manager 10g
657200Feb 20 2009 — edited Feb 24 2009Hi
I need to schedule a job that sends email periodically. I am using the scheduler in Oracle Enterprise Manager 10g for this. For sending the email, I am creating a PL/SQL job. The code is as follows:
DECLARE
l_mailhost VARCHAR2(64) := 'qiudubcorrel001.qa.local';
l_from VARCHAR2(64) := 'Kamal_Ganeriwala_tw@stercomm.com';
l_to VARCHAR2(64) := 'Kamal_Ganeriwala_tw@stercomm.com';
l_mail_conn UTL_SMTP.connection;
BEGIN
l_mail_conn := UTL_SMTP.open_connection(('10.253.14.240'), 25);
UTL_SMTP.helo(l_mail_conn, '10.253.14.240');
UTL_SMTP.mail(l_mail_conn, l_from);
UTL_SMTP.rcpt(l_mail_conn, l_to);
UTL_SMTP.data(l_mail_conn, 'Single string message.' || Chr(13));
UTL_SMTP.quit(l_mail_conn);
END;
I would like to point out that I have executed the above code from SQL workshop within Apex, and it is sending the email as desired, so there shouldn't be any issue with this code.
When the above job is run, the scheduler shows status as successful. If I go to the command step, it displays the following output:
Output Log
SQL> SQL> SQL> SQL> Connected.
SQL> SQL> 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Disconnected from Personal Oracle Database 10g Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
Now, the only issue is that I do not receive any email at the address specified! I would be very grateful if someone could point out the error here.
Thanks,
Kamal