diff options
author | Roberto E. Escobar | 2011-11-01 01:00:30 +0000 |
---|---|---|
committer | Roberto E. Escobar | 2011-11-01 01:00:30 +0000 |
commit | 6749225a3ad90ad4a90e491b11e0f25b6bc4e8a6 (patch) | |
tree | 9f9c38bb4c056913f3334b7411216af5ed4122d2 /plugins/org.eclipse.osee.mail | |
parent | b903647d9795302b730971fd7cc45b3d046aa340 (diff) | |
download | org.eclipse.osee-6749225a3ad90ad4a90e491b11e0f25b6bc4e8a6.tar.gz org.eclipse.osee-6749225a3ad90ad4a90e491b11e0f25b6bc4e8a6.tar.xz org.eclipse.osee-6749225a3ad90ad4a90e491b11e0f25b6bc4e8a6.zip |
feature[ats_36Z52]: Create Email view api and presenter
Diffstat (limited to 'plugins/org.eclipse.osee.mail')
-rw-r--r-- | plugins/org.eclipse.osee.mail/src/org/eclipse/osee/mail/MailUtils.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.mail/src/org/eclipse/osee/mail/MailUtils.java b/plugins/org.eclipse.osee.mail/src/org/eclipse/osee/mail/MailUtils.java index 3232ab58de2..1362bc375b4 100644 --- a/plugins/org.eclipse.osee.mail/src/org/eclipse/osee/mail/MailUtils.java +++ b/plugins/org.eclipse.osee.mail/src/org/eclipse/osee/mail/MailUtils.java @@ -18,6 +18,8 @@ import java.util.Date; import javax.activation.CommandMap; import javax.activation.DataSource; import javax.activation.MailcapCommandMap; +import javax.mail.internet.AddressException; +import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMultipart; import org.eclipse.osee.framework.jdk.core.util.Lib; @@ -34,6 +36,19 @@ public final class MailUtils { // Utility Class } + public static boolean isValidEmail(String email) { + boolean result = false; + try { + InternetAddress[] addresses = InternetAddress.parse(email, true); + if (addresses != null && addresses.length > 0) { + result = true; + } + } catch (AddressException ex) { + // Do Nothing + } + return result; + } + public static MailcapCommandMap getMailcapCommandMap() { MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); mc.addMailcap("text/*;; x-java-content-handler=com.sun.mail.handlers.text_plain"); |