I am having trouble sending mails using the UTL_SMTP package.
I have the SP and it gives me the error listed below.
Although, i DO GET AN EMAIL, but the email only contains first set of data from the cursor C2 loop, like you can see in my dbms_output. When the loop goes to fetch another set of data if errors out.
Any help will be highly appreciated. Thank you Very much.

SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE PROCEDURE SEND_HRMAIL
2 IS
3 --Declaring a cursor which will get the email addresses
4 cursor c1 is select send_recpt from tbl_hrmail;
5 cursor c2 is select name,job_title from tbl_terminationemp;
6 c utl_smtp.connection;
7 rc integer;
8 v_name VARCHAR2(100);
9 v_jobtitle VARCHAR2(100);
10 msg_from varchar2(50) := 'Oracle9.2';
11 mailhost VARCHAR2(30) := '10.1.1.40'; -- local database host
12 v_test varchar2(100) := 'Kalpa';
13 BEGIN
14 --Making a connection.
15 c := utl_smtp.open_connection(mailhost, 25); -- SMTP on port 25
16 utl_smtp.ehlo(c, mailhost);
17 utl_smtp.mail(c, msg_from);
18 --Looping through the email addresses
19 for c1rec in c1 loop
20 utl_smtp.rcpt(c,c1rec.send_recpt);
21 end loop;
22 --utl_smtp.rcpt(c, 'kparikh@decurion.com');
23 for c2rec in C2 loop
24 utl_smtp.data(c,c2rec.name || '-' ||c2rec.job_title);
25 dbms_output.put_line(c2rec.name || '-' ||c2rec.job_title);
26 end loop;
27 --Closing the connection.
28 utl_smtp.quit(c);
29* END;
SQL> /
Procedure created.
SQL> exec send_hrmail;
Sandoval,Gerardo-Hourly Operations Manager
BEGIN send_hrmail; END;
*
ERROR at line 1:
ORA-29279: SMTP permanent error: 503 5.5.2 Need mail command.
ORA-06512: at "SYS.UTL_SMTP", line 17
ORA-06512: at "SYS.UTL_SMTP", line 98
ORA-06512: at "SYS.UTL_SMTP", line 271
ORA-06512: at "SYS.UTL_SMTP", line 247
ORA-06512: at "SYS.UTL_SMTP", line 258
ORA-06512: at "SYSADM.SEND_HRMAIL", line 24
ORA-06512: at line 1