|
-
see u are assigning messag to ename first and then this
messag := 'DATE: '||to_char(sysdate, 'dd-mon-yy hh24:mi:ss')||crlf||
'FROM: <'||mitt||'>'||crlf||
'SUBJECT: '||object||crlf||
'TO: '||destinatario1||' '||crlf||messagge;
You have to concat the messag (ename) with messag('DATE: '||to_char(sysdate, 'dd-mon-yy hh24:mi:ss')||crlf||
'FROM: <'||mitt||'>'||crlf||
'SUBJECT: '||object||crlf||
'TO: '||destinatario1||' '||crlf||messagge
try this and modify,
CREATE OR REPLACE procedure send_mail ( mitt IN varchar2,
destinatario1 IN varchar2,
object IN varchar2,
messagge IN varchar2) IS
cursor my_cur is
select ename
from emp;
mailhost varchar2(40):= 'pop.mail.xxxxx.it';
conn utl_smtp.connection;
crlf varchar2(2):=CHR(13)||CHR(10);
messag varchar2(3000);
v_mitt varchar2(2000) := mitt;
BEGIN
conn := utl_smtp.open_connection (mailhost, 25);
--but u hv to decide where u need to paste the fetched ename...
for rec_msg in my_cur
loop
messag := 'DATE: '||to_char(sysdate, 'dd-mon-yy hh24:mi:ss')||crlf||
'FROM: <'||mitt||'>'||crlf||
'SUBJECT: '||object||crlf||
'TO: '||destinatario1||' '||crlf||messagge || i.ename;
utl_smtp.helo(conn, mailhost);
utl_smtp.mail (conn, v_mitt);
utl_smtp.rcpt (conn, destinatario1);
utl_smtp.data(conn, messag);
utl_smtp.quit(conn);
messag := rec_msg.ename;
end loop;
EXCEPTION
when utl_smtp.transient_error or utl_smtp.permanent_error then
utl_smtp.quit(conn);
raise_application_error (-20000, 'error: '||sqlerrm);
END send_mail;
Cheers!
Cheers!
OraKid.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|