29.05.2008

UTL_SMTP örnegi

DECLARE
c UTL_SMTP.CONNECTION;

PROCEDURE send_header(name IN VARCHAR2, header IN VARCHAR2) AS
BEGIN
UTL_SMTP.WRITE_DATA(c, name ': ' header UTL_TCP.CRLF);
END;

BEGIN
c := UTL_SMTP.OPEN_CONNECTION('smtp serverınız adı');
UTL_SMTP.HELO(c, 'bilginc.com');
UTL_SMTP.MAIL(c, 'zekeriyab@bilginc.com');
UTL_SMTP.RCPT(c, 'zekeriyabesiroglu@google.com');
UTL_SMTP.OPEN_DATA(c);
send_header('From', '"Sender" ');
send_header('To', '"Recipient" ');
send_header('Subject', 'Deneme');
UTL_SMTP.WRITE_DATA(c, UTL_TCP.CRLF 'deneme maili');
UTL_SMTP.CLOSE_DATA(c);
UTL_SMTP.QUIT(c);
EXCEPTION
WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
BEGIN
UTL_SMTP.QUIT(c);
EXCEPTION
WHEN UTL_SMTP.TRANSIENT_ERROR OR UTL_SMTP.PERMANENT_ERROR THEN
NULL;
END;
raise_application_error(-20000,
'Mail atarken problem olustu: ' sqlerrm);
END;

Hiç yorum yok: