Use UTL_SMTP package to send out an email
DECLARE
v_FromAddr VARCHAR2(50) := 'Oracle';
v_ToAddr VARCHAR2(50) := 'YOUR_EMAIL_ADDRESS';
v_Message VARCHAR2(200);
v_MailHost VARCHAR2(50) := 'localhost';
v_MailConnection UTL_SMTP.Connection;
BEGIN
v_Message :=
'From: ' || v_FromAddr || CHR(10) ||
'Subject: Hello from PL/SQL!' || CHR(10) ||
'message.';
v_MailConnection := UTL_SMTP.OPEN_CONNECTION(v_MailHost);
UTL_SMTP.HELO(v_MailConnection, v_MailHost);
UTL_SMTP.MAIL(v_MailConnection, v_FromAddr);
UTL_SMTP.RCPT(v_MailConnection, v_ToAddr);
UTL_SMTP.DATA(v_MailConnection, v_Message);
UTL_SMTP.QUIT(v_MailConnection);
END;
/
--
Related examples in the same category