|
Sybernet / Supplied Functions Reference
Release 3.00 Dec 03, 2002 |
|
This function provides a single-point of failure for dealing with e-mail addresses in your application. Consider an application that sends e-mail to nospam@nospams.com. One of two things is going to happen: your e-mail is sent successfully because the address is valid, or the e-mail is not sent because the e-mail address is not valid. In the latter case, a copy of your e-mail is sent to www at spock.sri.com. This can fill up disk space in short time. This function will raise an error if you pass it an e-mail address that is no longer valid.
Most of your applications have hard-wired the e-mail address when you really want to send your mail to a "suit" instead of a actual person. Instead of sending mail to ian.hunter@sri.com, the mailto function allows you to send your mail to the CEO. When the e-mail address of the CEO changes, you can change this e-mail address in one place and be done with it. You can even send to both while the transition takes place. http.mailto recognizes the following synonyms: CEO, CFO and CIO.
Looking up someone's email address is easy enough, but this function will do it for you automatically. You can pass it someone's name (a partial lastname or a partial first name followed by a full lastname), someone's phone number, someone's username, or someone's employee number. As long as the result is unique a valid e-mail address is returned. An exception is raised if the result is not unique or if no results were found.
In Oracle we have some usernames (or schemas) that are not real employees. This functaon handles these cases exactly the same way it handles references to the CEO. For example, DBA_ADMIN is a valid schema name in Oracle. http.mailto (when passed this name) will send e-mail to both Blake and Vasu. http.mailto recognizes the following schemas: HTTP, SYBERCRON, DBA_ADMIN, BWILSON, and ENE598.
The mailto function uses two tables: HTTP.HTTP_MAILTO and HTTP.PEOPLESOFT. HTTP.HTTP_MAILTO (also known as the address book) is used to map email addresses or any identifier to a valid e-mail address. HTTP.PEOPLESOFT is used to look up or validate email addresses. Although you are not allowed to edit the HTTP.PEOPLESOFT table, you can modify the HTTP.HTTP_MAILTO table. You can use VI to edit the address book. The important thing about the address book is that it takes precedence over anything passed or that which exists in the HTTP.PEOPLESOFT table.
The address book contains only a few obvious examples. If you like, you are welcome to add your own mappings in ORADEV. Your changes will be added to both ORAUSER and ORAPROD each evening.
Function MAILTO
(
MAILTO_LIST VARCHAR2
)
RETURN VARCHAR2;
| Parameter | Description |
|---|---|
mailto_list |
A list of identifiers separated by commas. Identifiers are first looked up in the address
book and can take any case-insensitive form.
identifierFailure to find them there causes mailto to look them up in the peoplesoft table. In this case identifier can be one of e-mail address telephone number employee number username firstname lastname |
http.mailto either returns a list of valid comma separated e-mail addresses or raises an exception. An exception is raised if any single address is invalid.
The following example illustrates how to retrieve the e-mail address for an employee number:
http.writeln(http.mailto('14568'));
The following example illustrates how to retrieve the e-mail address for a username:
http.writeln(http.mailto(user)); http.writeln(http.mailto);
The following example illustrates how to retrieve the e-mail address for a telephone number:
http.writeln(http.mailto('5328'));
The following example illustrates how to retrieve the e-mail address for someone's name:
http.writeln(http.mailto('denis workman'));
The following example illustrates how not to call mailto() and how you might hard-wire the e-mail address.
declare
row_id binary_integer;
begin
row_id:=http.sp_cron_insert
(
PROCNAME => 'http.dbo.sp_html_xmas'
, EMAIL => 'nospam@nospams.com'
, DATENAME => 'DECEMBER'
, DAY => '25'
, HOUR => '8'
) ;
end;
The following example illustrates how to validate or map someone's e-mail address. The address book might actually map this to a valid (or invalid) e-mail address since it takes precedence over anything else. If the address does not exist in the address book, then the e-mail address is validated.
declare
row_id binary_integer;
begin
row_id:=http.sp_cron_insert
(
PROCNAME => 'http.dbo.sp_html_xmas'
, EMAIL => http.mailto('nospam@nospams.com')
, DATENAME => 'DECEMBER'
, DAY => '25'
, HOUR => '8'
) ;
end;
The following example illustrates how to retrieve the e-mail address of the CEO, CFO and CIO:
http.writeln(http.mailto('CEO,CFO,CIO'));