CFLib.org – Common Function Library Project

webmasterEmail(input)

Last updated July 11, 2008

author

Michael Muller

Version: 1 | Requires: CF5 | 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:

/**
 * 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, September 27, 2008 
 */
function webmaster_email(input) {
    if(left(input,4) eq "http") return "webmaster@" & listRest(listGetAt(input,2,"/"),".");
    else return "webmaster@" & listRest(listFirst(input,"/"),".");
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson