CFLib.org – Common Function Library Project

EmailDomainLink(theEmailAddress[, theTarget])

Last updated September 29, 2003

author

Shawn Seley

Version: 1 | Requires: CF5 | Library: StrLib

Description:
Formats specified e-mail address so that its domain is a link to its www.domain.com web site. Helpful when analyzing where your subscribers come from.

Return Values:
Returns a string.

Example:

<cfoutput>
EmailDomainLink("admin@cflib.org"):<br>
#EmailDomainLink("admin@cflib.org")#<br>
<br>
EmailDomainLink("shawnse@aol.com", "_blank"):<br>
#EmailDomainLink("shawnse@aol.com", "_blank")#<br>
</cfoutput>

Parameters:

Name Description Required
theEmailAddress Email address. Yes
theTarget Optional target for new window. No

Full UDF Source:

/**
 * Formats an e-mail address so that its domain is a link to its web site.
 * 
 * @param theEmailAddress 	 Email address. (Required)
 * @param theTarget 	 Optional target for new window. (Optional)
 * @return Returns a string. 
 * @author Shawn Seley (shawnse@aol.com) 
 * @version 1, September 29, 2003 
 */
function emailDomainLink(theEmailAddress) {
	var this_username  = listFirst(theEmailAddress, "@");
	var this_domain    = listLast(theEmailAddress, "@");
	var theTarget      = "";
	if(arrayLen(arguments) gte 2) theTarget = arguments[2];
	if(Len(theTarget) GT 0) return "#this_username#@<a href=""http://www.#this_domain#"" target=""#theTarget#"">#this_domain#</a>";
	else return "#this_username#@<a href=""http://www.#this_domain#"">#this_domain#</a>";
}
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