|
|
|
Re: How to use the host command to send mail in Forms 6i through PLSQL [message #348312 is a reply to message #348300] |
Tue, 16 September 2008 07:01 |
|
This is a procedure i use
PROCEDURE send_email
( sendernm IN VARCHAR2,
senderid IN VARCHAR2,
recipient IN VARCHAR2,
subject IN VARCHAR2,
message IN LONG,
mailsrvr IN VARCHAR2)
IS
host VARCHAR2(30) := mailsrvr;
mail_conn utl_smtp.connection;
crlf VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );
msg long;
TMP_DATE DATE;
BEGIN
mail_conn := utl_smtp.open_connection(host, 25);
select sysdate into tmp_date from dual;
msg:= 'Date: ' || TO_CHAR(TMP_DATE-3/24,'dd Mon yy HH24:MI:SS')|| crlf ||
'From: '||sendernm||'<' ||senderid||'>' || crlf ||
'Subject: '||subject || crlf ||
'To: '||recipient || crlf ||
'' || crlf || message;
utl_smtp.helo(mail_conn, host);
utl_smtp.mail(mail_conn, senderid);
utl_smtp.rcpt(mail_conn, recipient);
utl_smtp.data(mail_conn, msg);
utl_smtp.quit(mail_conn);
Exception
When others then
Null;
END;
|
|
|