OSCore (Open Symphony Core) is a java library with lot of utilities and reusable components. This requires the libraries oscore-2.2.6.jar, mail.jar to be in classpath. The following example shows using TextUtils.linkEmail() API.
package com.bethecoder.tutorials.oscore; import com.opensymphony.util.TextUtils; public class LinkEmailTest { /** * @param args */ public static void main(String[] args) { String linkHtml = TextUtils.linkEmail("bethecoder@abcdefg.com"); System.out.println(linkHtml); linkHtml = TextUtils.linkEmail("<span>INFO [info@java.net]</span>"); System.out.println(linkHtml); } }
<a href='mailto:bethecoder@abcdefg.com'>bethecoder@abcdefg.com</a> <span>INFO [<a href='mailto:info@java.net'>info@java.net</a>]</span>