Documentos de Académico
Documentos de Profesional
Documentos de Cultura
From
Oracle Forms Builder
https://facebook.com/groups/300518527009351/
If you don't see the file there, type " Send Email From Oracle
Forms Builder " in my Facebook group's search box.
First and Foremost
Please! don’t forget to click or watch at least one Ad that show
up on YouTube during this tutorial.
Thank You!
Step 1 Signing Up for a New SMTP2GO Account (It’s free )
Simple Mail Transfer Protocol (SMTP) is an Internet standard for electronic mail (email) transmission. SMTP2GO.COM provides free outgoing mail SMTP server
If you don't have one.
https://www.smtp2go.com/
Step 2 Creating A New Table and Adding Some Email Addresses
I’m creating a table from rows in Employees table by applying the AS subquery clause, which both creates the table and inserts rows returned from the
subquery.
Update COPY_EMP
SET EMAIL = person1@example.com'
WHERE EMPLOYEE_ID = 100;
Update COPY_EMP
SET EMAIL = 'person2@example.com'
WHERE EMPLOYEE_ID = 101;
Update COPY_EMP
SET EMAIL = 'person3@example.com'
WHERE EMPLOYEE_ID = 102;
Update COPY_EMP
SET EMAIL = 'person4@example.com'
WHERE EMPLOYEE_ID = 103;
Update COPY_EMP
SET EMAIL = 'person5@example.com'
WHERE EMPLOYEE_ID = 104;
Step 3 Creating a New Form
Using the Property Palette, set the following properties on the new item:
Property Value
Name Send_Email
Title My Send Email App
Using the Property Palette, set the following properties on the new item:
Property Value
Name Send_Email
Single Record Yes
Database Data Block No
Step 5 Adding Non Base Table Items to a Control Block
Add the following items to your form and set their properties as listed:
Property Item Type Name Prompt (Label) Data Type, Database Other Properties Initial Value
Length Item
Text Item TXT_SENDER_NAME Sender Full Name No HR Department
Text Item TXT_SENDER_EMAIL Sender Email Address 64 No The Email address you
specified in your smtp2go
registration form
Text Item TXT_TO To 256 No
In LOV wizard:
enter the following SQL query statement for the LOV’s Record Group.
SELECT ALL COPY_EMP.FIRST_NAME, COPY_EMP.LAST_NAME, COPY_EMP.EMAIL
FROM COPY_EMP
ORDER BY COPY_EMP.EMPLOYEE_ID ASC
Using the Property Palette, set the following properties on the new LOV:
Property Value
Name LOV_EMAILS_LIST
Title Emails List
Width 508
Height 300
In this step, we are adding functionality by coding PL/SQL program units and triggers in our form. We shall create the following procedures or functions in our
form.
FUNCTION CREATE_RECIPIENTS_LIST (recipients IN VARCHAR2) RETURN VARCHAR2 IS
a_value_chosen BOOLEAN;
recipientsList VARCHAR2(256) := recipients;
BEGIN
a_value_chosen := Show_Lov('LOV_EMAILS_LIST');
RETURN recipientsList;
END;
PROCEDURE SPLIT_MULTIPLE_EMAIL_ADDRESSES (conexion IN OUT UTL_SMTP.connection, p_list IN VARCHAR2, p_del IN VARCHAR2) IS
l_idx pls_integer;
l_list varchar2(256) := p_list;
l_value varchar2(256);
begin
loop
l_idx := instr(l_list,p_del);
if l_idx > 0 then
UTL_SMTP.rcpt(conexion, substr(l_list,1,l_idx-1));
l_list := substr(l_list,l_idx+length(p_del));
else
UTL_SMTP.rcpt(conexion, l_list);
exit;
end if;
end loop;
END SPLIT_MULTIPLE_EMAIL_ADDRESSES;
PROCEDURE SET_STATUS_INDICATOR (indicatorColor IN VARCHAR2) IS
gif_image_dir VARCHAR2(80) := 'D:\Send_EMail\';
photo_filename VARCHAR2(80);
BEGIN
/*
** Set the message level high so we can gracefully handle
** an error reading the file if it occurs
*/
:System.Message_Level := '25';
/*
** filename from which to load the GIF image. The form
** has a image item named 'IMG_STATUS_INDICATOR'
** into which we read the image.
*/
photo_filename := gif_image_dir|| 'Trafic Lights ' || indicatorColor ||'.gif';
/*
** For example 'photo_filename' might look like:
**
** D:\Send_EMail\Trafic Lights Green.gif
** ------
**
** Now, read in the appropriate image.
*/
p_Subject IN VARCHAR2,
p_message_Body IN VARCHAR2,
p_SMTP_Server IN VARCHAR2, -- The host name of the outgoing mail server (SMTP), such as smtp.example.com.
p_SMTP_Port IN NUMBER, -- The port number used by the outgoing mail server. Common port numbers for outgoing
mail are 25, 465, and 587.
p_SMTP_Username IN VARCHAR2, -- Your email account user name, such as appleseed. Some email providers want your full email
address as your user name.
p_SMTP_Password IN VARCHAR2, -- The email password you use to sign in to your account.
p_Format IN VARCHAR2
)
IS
v_Mail_Conn UTL_SMTP.connection;
v_Encoded_Username varchar2(2048);
v_Encoded_Password varchar2(2048);
CRLF VARCHAR2(2) := chr(13)||chr(10);/*
--prepare headers
UTL_SMTP.mail(v_Mail_Conn, p_Sender_Email);
/*if we have multiple recipients or CCs, we must call UTL_SMTP.rcpt once for each one
however, we shall specify that there are CCs in the mail header in order for them to appear as such*/
SPLIT_MULTIPLE_EMAIL_ADDRESSES(v_Mail_Conn, p_To, ',');
IF TRIM(p_CC) IS NOT NULL THEN
SPLIT_MULTIPLE_EMAIL_ADDRESSES(v_Mail_Conn, p_CC, ',');
END IF;
IF TRIM(p_BCC) IS NOT NULL THEN
SPLIT_MULTIPLE_EMAIL_ADDRESSES(v_Mail_Conn, p_BCC, ',');
END IF;
UTL_SMTP.open_data(v_Mail_Conn);
SET_STATUS_INDICATOR('Green');
EXCEPTION
WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
BEGIN
UTL_SMTP.QUIT(v_Mail_Conn);
EXCEPTION
WHEN UTL_SMTP.TRANSIENT_ERROR OR UTL_SMTP.PERMANENT_ERROR THEN
NULL; -- When the SMTP server is down or unavailable, we don't have
-- a connection to the server. The QUIT call raises an
-- exception that we can ignore.
END;
Message(sqlerrm);
SET_STATUS_INDICATOR('Red');
END;
BTN_EMAILS_LIST_TO
BEGIN
:TXT_TO := CREATE_RECIPIENTS_LIST(:TXT_TO);
END;
BTN_EMAILS_LIST_CC
BEGIN
:TXT_CC := CREATE_RECIPIENTS_LIST(:TXT_CC);
END;
BTN_EMAILS_LIST_BCC
BEGIN
:TXT_BCC := CREATE_RECIPIENTS_LIST(:TXT_BCC);
END;
BTN_SEND_MESSAGE
BEGIN
SET_STATUS_INDICATOR('Red');
END;
Step 8 Creating an Access Control List (ACL)
Oracle 11g introduces fine grained access to network services using access control lists (ACL) in the XML DB repository, allowing control over which users access
which network resources, regardless of package grants.
BEGIN
DBMS_NETWORK_ACL_ADMIN.create_acl (
acl => 'Send_Email.xml',
description => 'Allow mail to be send.',
principal => 'HR',
is_grant => TRUE,
privilege => 'connect',
start_date => SYSTIMESTAMP,
end_date => NULL);
COMMIT;
END;
OPTIONAL
How to view ACL.
SELECT *
FROM dba_network_acls;
I am pleased to inform you that your salary is being increased as of January 1, 2016.
You are being awarded a 3% merit increase due to your excellent performance and valuable contributions to your department and to the corporation. Your
new annual salary will be $120,000.
In addition to your salary increase, many of your benefits such as retirement are indexed to your salary and will be increased accordingly.
Sincerely,
Human Resources Department
People should stop skipping ads when they watch some of their favorite creators... don't make them to go out of business! Also the best thing you can do for
youTubers is sharing their content.
Muhammad Abid
YouTube Video Producer
http://www.sautinsoft.net/