ikb_mailsender

The PL/SQL ikb_mailsender-package is used to send emails to one or more recipients.

PLSQL API

See also: PL/SQL ContentServices API and the package “IKB_MAILSENDER”.

Mail

The PLSQL API supports a method to send mail to one or more recipants with or without attachments. This is the properties:

Parameter Description Type Required
p_profile Applies only if ikb_global_prefs.has_oracle_smtp is FALSE, refers to ikb_installation_properties values for email settings VARCHAR2 NO
p_from A valid email address VARCHAR2 YES
p_subject The title of the email VARCHAR2 YES
p_recip One or more recipients defined as an array ARRAY NO
p_cc One or more recipients defined as an array sent as CC (Carbon copy) ARRAY NO
p_bcc One or more recipients defined as an array sent as BCC (Blind copy) ARRAY NO
p_attachment An array of attachments ct_attachment NO
p_header_name Array of header name. Must correspond with p_header_value ARRAY NO
p_header_value Array of header name. Must correspond with p_header_name ARRAY NO
p_text_body The mail body as text. Only used by java mail function CLOB NO
p_html_body The mail body as HTML. CLOB NO
p_send_individual If many recipients; Should the mail be sent as a single email or one for each recipient? Valid values are Y or N VARCHAR2 NO

Example procedure for sending a file to recipiants with cc and bcc as arrays as a single mail:

procedure send_file (p_filename in varchar2, p_mimetype in varchar2, p_file blob) is 
begin
	ikb_mailsender.send(p_profile => 'default',
	              p_from => ''myadr-from-0@dummy.no'',
		      p_recip  => sendmail.makeArray(ct_value_varchars(
		      				ot_value_varchar('myadr-0@dummy.no'),
		      				ot_value_varchar('myadr-1@dummy.no'))),
		      p_subject => 'This is a mail',
		      p_text_body => 'With some content',
		      p_html_body => '@<h1>With some content</h1>@',
		      p_attachment => ct_attachment(
		      			ot_attachment(p_filename,p_mimetype,p_file)),
		      p_cc  => sendmail.makeArray(ct_value_varchars(
		      				ot_value_varchar('myadr-2@dummy.no'),
		      				ot_value_varchar('myadr-3@dummy.no'))),
		      p_bcc  => sendmail.makeArray(ct_value_varchars(
		      				ot_value_varchar('myadr-4@dummy.no'),
		      				ot_value_varchar('myadr-5@dummy.no'))),
		      p_send_individual => 'N',
		      p_header_name  => sendmail.makeArray(ct_value_varchars(
		      				ot_value_varchar('x-priority'),
		      				ot_value_varchar('Return-Path'))),
		      p_header_value => sendmail.makeArray(ct_value_varchars(
		      				ot_value_varchar('1'),
		      				ot_value_varchar('my-return-path'))));
end;