Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Stored Procedures and Email
I use a the following code (modified a bit, but should still work):
CREATE OR REPLACE PROCEDURE sendmail (sender VARCHAR2, subject
VARCHAR2) IS
v_connection UTL_SMTP.CONNECTION;
v_reply UTL_SMTP.REPLY; mesg VARCHAR2(999); crlf VARCHAR2(2) := CHR(13)||CHR(10); err_msg VARCHAR2(1200); mailserver VARCHAR2(40); error_type VARCHAR2(60);
v_connection := UTL_SMTP.OPEN_CONNECTION(n.mailserver,25); v_reply := UTL_SMTP.HELO(v_connection,n.mailserver); v_reply := UTL_SMTP.MAIL(v_connection,n.email_address); v_reply := UTL_SMTP.RCPT(v_connection,n.email_address);mesg :=
'Date: '||TO_DATE(sysdate,'DD/MON/RRRR:HH24:MI:SS')||crlf|| 'From: '||sender||crlf|| 'Subject: '||subject||crlf|| 'To: '||n.email_address||crlf;
"Adam Gent" <a.l.gent_at_cs.cf.ac.uk> wrote in message news:<1013787834.30041.0_at_iapetus.uk.clara.net>...
> Hi,
>
> Is there anyway to send emails from within oracle stored procedures.
>
> Thanks,
>
> Adam Gent
> a.l.gent_at_cs.cf.ac.uk
Received on Fri Feb 15 2002 - 12:00:58 CST
![]() |
![]() |