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,"/"),".");
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson