Send email to address based on select list value
Using apex 4.1.
I have crated a Page Process type PL/SQL, On Submit - After Computations and Validations which emails a user successfully.
I'd like to modify the Page Process to email a user based on the value in Select List P2_type. Apologies for the badly written code (newbie to apex and sql).
DECLARE
ls_EmailTo VARCHAR2(128);
BEGIN
IF :P2_TYPE = 'Hardware' THEN
ls_EmailTo := 'hardware@somewhere.com';
ELSE IF :P2_TYPE = 'Software' THEN
ls_EmailTo := 'software@somewhere.com';
END IF;
APEX_MAIL.SEND( p_to => ls_EmailTo,
p_from => 'some_user@user.com',
p_body =>
'Blurb here:'||:P2_TYPE,
p_subj => 'New Request for '||:P2_CUSTOMER||' On '||:P2_DATE);
Many thanks
Jason