Saturday, August 13, 2011

Send e mail through PL SQL code

CREATE OR REPLACE
PROCEDURE erpschools_send_email
IS
mailhost VARCHAR2 (30) := 'smtp.erpschools.com';
crlf VARCHAR2(2)Â := CHR (13) || CHR (10);
v_email VARCHAR2(16000);
message_1 LONG;
mail_conn utl_smtp.connection;
BEGIN
mail_conn := utl_smtp.open_connection (mailhost, 25);
utl_smtp.helo (mail_conn, mailhost);
utl_smtp.mail (mail_conn, 'sender@oracle.com');
utl_smtp.rcpt (mail_conn, 'receiver@oracle.com');
MESSAGE_1 := 'From: Mr Sender < sender@oracle.com >'
|| CRLF || 'Subject: Testing Hyperlink'
|| CRLF || 'To: Mrs Receiver '
|| CRLF || ''
|| crlf || crlf ;
UTL_SMTP.DATA(MAIL_CONN, 'MIME-Version: 1.0'
||CHR(13)
||CHR(10)
||'Content-type: text/html'
|| CHR(13)
||CHR(10)
||message_1);
utl_smtp.quit (mail_conn);
END;

No comments:

Post a Comment

Best Blogger TipsGet Flower Effect