Databases Reference
In-Depth Information
3-9. Sending an E-mail from the Form
Problem
You need to send an e-mail when you click a button on the form. You also want to use data entered
through the form as various parameters in the e-mail.
Solution
To test the solution in this recipe, you will first need to create the sample database and form objects.
Then you will need to invoke the Send Email process from your form. Let's start by creating the sample
objects used in this recipe.
Creating the Sample Object
To create the sample objects used in this recipe, follow these steps:
1.
Create the table shown in Listing 3-12, and create a new database
application/data entry form over the table.
Listing 3-12. The PatientDB Table
CREATE table "PATIENTDB" (
"PATIENTNAME" NVARCHAR2(255),
"PATIENTEMAIL" NVARCHAR2(255),
"PATIENTDIAGNOSIS" NVARCHAR2(2000),
"PATIENTID" NVARCHAR2(10),
constraint "PATIENTDB_PK" primary key ("PATIENTID")
)
/
CREATE sequence "PATIENTDB_SEQ"
/
CREATE trigger "BI_PATIENTDB"
before insert on "PATIENTDB"
for each row
begin
if :NEW."PATIENTID" is null then
select "PATIENTDB_SEQ".nextval into :NEW."PATIENTID" from dual;
end if;
end;
/
Sending the E-mail
To invoke the Send E-mail process from your form, follow these steps:
 
Search WWH ::




Custom Search