I have an application where I send Email with an attachment. It seems to be working fine. I am now adding content to the body of the Email and I am running into an issue of how to setup the body. To test it out, I created a small amount of html that is placed into the p_body_html portion of the send mail script, but because it is going to be quite a bit (more than 1000 characters) to create the actual html table, I am trying to create it in a declared variable and then have the p_body_html call the variable l_body_html and that is where I am running into the following error:
1 error has occurred
* ORA-06550: line 9, column 9: PLS-00307: too many declarations of 'SEND' match this call
ORA-06550: line 9, column 1: PL/SQL: Statement ignored
The code that is working is:
DECLARE
l_id NUMBER;
l_body_html CLOB;
BEGIN
l_id := APEX_MAIL.SEND(
p_to => :P4_TO,
p_from => 'walter.steadman@oracle.com',
p_body => 'Please review the attachment.',
p_body_html => '<html><head></head><body><table width="615" border="0" align="center" cellpadding="0" cellspacing="0" RULES=NONE FRAME=BOX style="cellpadding:0 cellspacing:0"><tr><td height="32" colspan="2" bgcolor="#FF0000">Information</td></tr><tr><td colspan="2">Testing</td></tr><tr><td>One</td><td>Two</td></tr></table></body></html>',
p_subj => :P4_TITLE);
FOR c1 IN (SELECT filename, attachment, mimetype
FROM ATTACH_EMAIL
WHERE recordid = :P4_recordid) LOOP
APEX_MAIL.ADD_ATTACHMENT(
p_mail_id => l_id,
p_attachment => c1.attachment,
p_filename => c1.filename,
p_mime_type => c1.mimetype);
END LOOP;
COMMIT;
END;
The code that is not working is:
DECLARE
l_id NUMBER;
l_body_html CLOB;
BEGIN
l_body_html :='<html><head></head><body><table width="615" border="0" align="center" cellpadding="0" cellspacing="0" RULES=NONE FRAME=BOX style="cellpadding:0 cellspacing:0"><tr><td height="32" colspan="2" bgcolor="#FF0000">Information</td></tr><tr><td colspan="2">Testing</td></tr><tr><td>One</td><td>Two</td></tr></table></body></html>';
l_id := APEX_MAIL.SEND(
p_to => :P4_TO,
p_from => 'walter.steadman@oracle.com',
p_body => 'Please review the attachment.',
p_body_html => l_body_html,
p_subj => :P4_TITLE);
FOR c1 IN (SELECT filename, attachment, mimetype
FROM ATTACH_EMAIL
WHERE recordid = :P4_recordid) LOOP
APEX_MAIL.ADD_ATTACHMENT(
p_mail_id => l_id,
p_attachment => c1.attachment,
p_filename => c1.filename,
p_mime_type => c1.mimetype);
END LOOP;
COMMIT;
END;
I have declared the l_body_html as CLOB and then I populate it with code and then I have the p_body_html reference it. I have this working in other EMail forms that don't have attachments and it works great. Not sure how I have too many declarations as the error states and would appreciate any assistance
Thanks
Wally