CFLib.org – Common Function Library Project

webmasterEmail(input)

Last updated July 11, 2008
Download UDF

author

Michael Muller Michael Muller

Version: 1 | Requires: ColdFusion 5 | Library: UtilityLib

Description:
This UDF takes a URL string input and creates a webmaster@ e-mail address. String can contain leading http:// or not, ie; webmaster_email("http://www.yoursite.com/somefolder/somepage.cfm?something=something") would produce "webmaster@yoursite.com" This UDF was written as part of a 404 application, which, among other things, culls e-mail addresses from referer pages with broken links to my site. The app pulls e-mail addresses off cgi.http_referer and this little function adds a webmaster address for the domain.

Return Values:
Returns a string.

Example:

<cfoutput>
webmaster_email("http://www.cflib.org/submit.cfm") produces
#webmaster_email("http://www.cflib.org/submit.cfm")#
</cfoutput>

Parameters:

Name Description Required
input URL to parse. Yes

Full UDF Source:

<cfscript>
/**
* creates a webmaster@... address out of any URL.
*
* @param input      URL to parse. (Required)
* @return Returns a string.
* @author Michael Muller (michael@mullertech.com)
* @version 1, July 11, 2008
*/

function webmaster_email(input) {
if(left(input,4) eq "http") return "webmaster@" & listRest(listGetAt(input,2,"/"),".");
else return "webmaster@" & listRest(listFirst(input,"/"),".");
}
</cfscript>

Search CFLib.org


Latest Additions

Topper Topper added
getCurrentURL
1 hour(s) ago

Daniel Chicayban Daniel Chicayban added
IsListInList
1 day(s) ago

Jeff Howden Jeff Howden added
CSVFormat
9 day(s) ago

Tom de Manincor Tom de Manincor added
flattenStruct
10 day(s) ago

Troy Pullis Troy Pullis added
iCalUS
10 day(s) ago

Created by Raymond Camden / Design by Justin Johnson