PL/SQL Email Client


Package mail_filter

Use the package MAIL_FILTER to set search filters for the MAIL_CLIENT.GET_MAIL_HEADERS function. Filters set with MAIL_FILTER are being executed on the mail server - so that fewer emails will be downloaded to the database. So using MAIL_FILTER is typically more efficient thanm filtering the result of MAIL_CLIENT.GET_MAIL_HEADERS with a SQL WHERE clause. The various ADD_..._FILTER procedures add filters to the search operation being executed when the mail headers are being retrieved. By default, multiple filters are being combined by AND. Use the SET_FILTER_COMBINATION procedure to change this. The P_MATCH attribute of each filter determines whether the mail server should look for true or false matches. Use the CLEAR_FILTERS procedure in order to remove all filters previously set. MAIL_CLIENT.GET_MAIL_HEADERS will then retrieve all mails of the selected server folder. Usage:
 -- Retrieve only mails which were sent since yesterday
 MAIL_FILTER.ADD_SENTDATE_FILTER(sysdate - 1, '>=', true);
 -- Retrieve only mails which are sent directly to John Doe ("to", not "cc" or "bcc")
 MAIL_FILTER.ADD_TO_FILTER('john.doe@company.com');
 -- Retrieve all mails except those directly sent to John Doe ("to", not "cc" or "bcc")
 MAIL_FILTER.ADD_TO_FILTER('john.doe@company.com', false);
 


Field Summary
 numberFILTER_COMB_AND
           Constant for mail filter combination: {filter1} AND {filter2} AND ... AND {filterN}
 numberFILTER_COMB_NOT_AND
           Constant for mail filter combination: NOT({filter1} AND {filter2} AND ... AND {filterN})
 numberFILTER_COMB_NOT_OR
           Constant for mail filter combination: NOT({filter1} OR {filter2} OR ... AND {filterN})
 numberFILTER_COMB_OR
           Constant for mail filter combination: {filter1} OR {filter2} OR ... OR {filterN}

Method Summary
 add_bcc_filter(p_filter varchar2, p_match boolean)
           Adds a filter for the Email recipient attribute CC.
 add_body_filter(p_filter varchar2, p_match boolean)
           Adds a filter to search within the email body.
 add_cc_filter(p_filter varchar2, p_match boolean)
           Adds a filter for the Email recipient attribute TO.
 add_deleted_filter(p_match boolean)
           Adds a filter for the "DELETED" flag of an email.
 add_from_filter(p_filter varchar2, p_match boolean)
           Adds a filter for the Email sender attribute (FROM).
 add_header_filter(p_header varchar2, p_filter varchar2, p_match boolean)
           Adds a filter for any given Email haeder.
 add_receiveddate_filter(p_filter date, p_comp varchar2, p_match boolean)
           Adds a filter for the datetime at which the Email was received by the mail server.
 add_seen_filter(p_match boolean)
           Adds a filter for the "SEEN" flag of an email.
 add_sentdate_filter(p_filter date, p_comp varchar2, p_match boolean)
           Adds a filter for the datetime at which the Email was sent.
 add_size_filter(p_filter number, p_comp varchar2, p_match boolean)
           Adds a filter for the message size.
 add_subject_filter(p_filter varchar2, p_negative boolean)
           Adds a filter for the Email subject.
 add_to_filter(p_filter varchar2, p_match boolean)
           Adds a filter for the Email recipient attribute BCC.
 clear_filters()
           Clears all previously set mail filters.
 set_filter_combination(p_combination number)
           Determines how multiple search filters are to be combined.

Field Detail

FILTER_COMB_AND

  public number FILTER_COMB_AND
Constant for mail filter combination: {filter1} AND {filter2} AND ... AND {filterN}

FILTER_COMB_OR

  public number FILTER_COMB_OR
Constant for mail filter combination: {filter1} OR {filter2} OR ... OR {filterN}

FILTER_COMB_NOT_AND

  public number FILTER_COMB_NOT_AND
Constant for mail filter combination: NOT({filter1} AND {filter2} AND ... AND {filterN})

FILTER_COMB_NOT_OR

  public number FILTER_COMB_NOT_OR
Constant for mail filter combination: NOT({filter1} OR {filter2} OR ... AND {filterN})

Method Detail

clear_filters

public  clear_filters()
Clears all previously set mail filters. GET_MAIL_HEADERS will not return all contents of the mail folder.


add_from_filter

public  add_from_filter(p_filter varchar2, 
p_match boolean)
Adds a filter for the Email sender attribute (FROM). Subsequent calls of GET_MAIL_HEADERS will only return Emails matching this filter
Parameters:
p_filter - The text for search for in the FROM attribute of an email.
p_match - true (default): return email matching the filter - false: return all other emails


add_cc_filter

public  add_cc_filter(p_filter varchar2, 
p_match boolean)
Adds a filter for the Email recipient attribute TO. Subsequent calls of GET_MAIL_HEADERS will only return Emails matching this filter
Parameters:
p_filter - The text for search for in the TO attribute of an email.
p_match - true (default): return email matching the filter - false: return all other emails


add_bcc_filter

public  add_bcc_filter(p_filter varchar2, 
p_match boolean)
Adds a filter for the Email recipient attribute CC. Subsequent calls of GET_MAIL_HEADERS will only return Emails matching this filter
Parameters:
p_filter - The text for search for in the CC attribute of an email.
p_match - true (default): return email matching the filter - false: return all other emails


add_to_filter

public  add_to_filter(p_filter varchar2, 
p_match boolean)
Adds a filter for the Email recipient attribute BCC. Subsequent calls of GET_MAIL_HEADERS will only return Emails matching this filter
Parameters:
p_filter - The text for search for in the BCC attribute of an email.
p_match - true (default): return email matching the filter - false: return all other emails


add_sentdate_filter

public  add_sentdate_filter(p_filter date, 
p_comp varchar2,
p_match boolean)
Adds a filter for the datetime at which the Email was sent. Subsequent calls of GET_MAIL_HEADERS will only return Emails matching this filter
Parameters:
p_filter - The date to compare with the send date of the email.
p_comp - Comparison operator: Choose between =, !=, < > <= or >=
p_match - true (default): return email matching the filter - false: return all other emails


add_receiveddate_filter

public  add_receiveddate_filter(p_filter date, 
p_comp varchar2,
p_match boolean)
Adds a filter for the datetime at which the Email was received by the mail server. Subsequent calls of GET_MAIL_HEADERS will only return Emails matching this filter
Parameters:
p_filter - The date to compare with the receiving date of the email.
p_comp - Comparison operator: Choose between =, !=, < > <= or >=
p_match - true (default): return email matching the filter - false: return all other emails


add_subject_filter

public  add_subject_filter(p_filter varchar2, 
p_negative boolean)
Adds a filter for the Email subject. Subsequent calls of GET_MAIL_HEADERS will only return Emails matching this filter
Parameters:
p_filter - The text for search for in the email subject.


add_deleted_filter

public  add_deleted_filter(p_match boolean)
Adds a filter for the "DELETED" flag of an email. Subsequent calls of GET_MAIL_HEADERS will only return Emails matching this filter
Parameters:
p_match - true (default): return email matching the filter - false: return all other emails


add_header_filter

public  add_header_filter(p_header varchar2, 
p_filter varchar2,
p_match boolean)
Adds a filter for any given Email haeder. Subsequent calls of GET_MAIL_HEADERS will only return Emails matching this filter
Parameters:
p_header - The name of the header field to filter on.
p_filter - The text for search for in the given header.
p_match - true (default): return email matching the filter - false: return all other emails


add_seen_filter

public  add_seen_filter(p_match boolean)
Adds a filter for the "SEEN" flag of an email. Subsequent calls of GET_MAIL_HEADERS will only return Emails matching this filter
Parameters:
p_match - true (default): return email matching the filter - false: return all other emails


add_body_filter

public  add_body_filter(p_filter varchar2, 
p_match boolean)
Adds a filter to search within the email body. All parts of type "text/*" are being searched. Subsequent calls of GET_MAIL_HEADERS will only return Emails matching this filter
Parameters:
p_match - true (default): return email matching the filter - false: return all other emails


add_size_filter

public  add_size_filter(p_filter number, 
p_comp varchar2,
p_match boolean)
Adds a filter for the message size. Subsequent calls of GET_MAIL_HEADERS will only return Emails matching this filter
Parameters:
p_filter - The size to be compared with in bytes.
p_comp - Comparison operator: Choose between =, !=, < > <= or >=
p_match - true (default): return email matching the filter - false: return all other emails


set_filter_combination

public  set_filter_combination(p_combination number)
Determines how multiple search filters are to be combined.
Parameters:
p_combination - Choose one of the 4 predefined constants.
 FILTER_COMB_AND:     {filter1} AND {filter2} AND ... {filterN}
 FILTER_COMB_OR:      {filter1} OR {filter2} OR ... {filterN}
 FILTER_COMB_NOT_AND: NOT ( {filter1} AND {filter2} AND ... {filterN} )
 FILTER_COMB_NOT_OR:  NOT ( {filter1} OR {filter2} OR ... {filterN} )
 


PL/SQL Email Client