com.flexive.shared
Class FxMailUtils

java.lang.Object
  extended by com.flexive.shared.FxMailUtils

public class FxMailUtils
extends java.lang.Object

Email Utilities.

Author:
Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)

Constructor Summary
FxMailUtils()
           
 
Method Summary
static java.lang.String encodeAttachment(java.lang.String mimeType, java.lang.String fileName, java.io.File data)
          Encode a file as email attachment
static java.lang.String encodeAttachment(java.lang.String mimeType, java.lang.String fileName, java.io.InputStream input)
          Encode an input stream as email attachment
static boolean isValidEmail(java.lang.String email)
          Simple check for valid email address
static void sendMail(java.lang.String SMTPServer, java.lang.String subject, java.lang.String textBody, java.lang.String htmlBody, java.lang.String to, java.lang.String cc, java.lang.String bcc, java.lang.String from, java.lang.String replyTo, java.lang.String... mimeAttachments)
          Sends an email
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FxMailUtils

public FxMailUtils()
Method Detail

isValidEmail

public static boolean isValidEmail(java.lang.String email)
Simple check for valid email address

Parameters:
email - address to check
Returns:
valid

encodeAttachment

public static java.lang.String encodeAttachment(java.lang.String mimeType,
                                                java.lang.String fileName,
                                                java.io.InputStream input)
                                         throws java.io.IOException
Encode an input stream as email attachment

Parameters:
mimeType - mime type
fileName - filename
input - the data to encode
Returns:
file encoded as email attachment
Throws:
java.io.IOException - on errors

encodeAttachment

public static java.lang.String encodeAttachment(java.lang.String mimeType,
                                                java.lang.String fileName,
                                                java.io.File data)
                                         throws java.io.IOException
Encode a file as email attachment

Parameters:
mimeType - mime type
fileName - filename
data - the file to encode
Returns:
file encoded as email attachment
Throws:
java.io.IOException - on errors

sendMail

public static void sendMail(java.lang.String SMTPServer,
                            java.lang.String subject,
                            java.lang.String textBody,
                            java.lang.String htmlBody,
                            java.lang.String to,
                            java.lang.String cc,
                            java.lang.String bcc,
                            java.lang.String from,
                            java.lang.String replyTo,
                            java.lang.String... mimeAttachments)
                     throws FxApplicationException
Sends an email

Parameters:
SMTPServer - IP Address of the SMTP server
subject - subject of the email
textBody - plain text
htmlBody - html text
to - recipient
cc - cc recepient
bcc - bcc recipient
from - sender
replyTo - reply-to address
mimeAttachments - strings containing mime encoded attachments
Throws:
FxApplicationException - on errors