info.fingo.util
Class Internet

java.lang.Object
  extended by info.fingo.util.Internet

public class Internet
extends java.lang.Object

Internet related helper functions.
This class need javax.mail library to work

Author:
FINGO - Robert Marek

Field Summary
static int PRIORITY_HIGH
          The email priority: high = 1
static int PRIORITY_LOW
          The email priority: low = 3
static int PRIORITY_NORMAL
          The email priority: normal = 2
 
Constructor Summary
Internet()
           
 
Method Summary
static boolean checkEmail(java.lang.String email)
          Check if email address is correct
static void sendEmail(java.lang.String server, java.lang.String from, java.lang.String[] to, java.lang.String[] cc, java.lang.String[] bcc, java.lang.String subject, java.lang.String body, java.lang.String encoding, boolean isHtml)
          Sends an email to many recipients.
static void sendEmail(java.lang.String server, java.lang.String from, java.lang.String[] to, java.lang.String[] cc, java.lang.String[] bcc, java.lang.String subject, java.lang.String body, java.lang.String encoding, boolean isHtml, int priority)
          Sends an email to many recipients with the specified priority.
static void sendEmail(java.lang.String server, java.lang.String from, java.lang.String to, java.lang.String subject, java.lang.String body, boolean isHtml)
          Sends an email.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRIORITY_LOW

public static final int PRIORITY_LOW
The email priority: low = 3

See Also:
Constant Field Values

PRIORITY_NORMAL

public static final int PRIORITY_NORMAL
The email priority: normal = 2

See Also:
Constant Field Values

PRIORITY_HIGH

public static final int PRIORITY_HIGH
The email priority: high = 1

See Also:
Constant Field Values
Constructor Detail

Internet

public Internet()
Method Detail

checkEmail

public static boolean checkEmail(java.lang.String email)
Check if email address is correct

Parameters:
email - email address
Returns:
true if OK, false else

sendEmail

public static void sendEmail(java.lang.String server,
                             java.lang.String from,
                             java.lang.String to,
                             java.lang.String subject,
                             java.lang.String body,
                             boolean isHtml)
                      throws java.lang.Exception
Sends an email.

Parameters:
server - the smtp host to send the message.
from - the 'from' email address
to - target recipient email
subject - the message subject
body - the email body
isHtml - the format indicator: true for HTML, false for text
Throws:
java.lang.Exception

sendEmail

public static void sendEmail(java.lang.String server,
                             java.lang.String from,
                             java.lang.String[] to,
                             java.lang.String[] cc,
                             java.lang.String[] bcc,
                             java.lang.String subject,
                             java.lang.String body,
                             java.lang.String encoding,
                             boolean isHtml)
                      throws java.lang.Exception
Sends an email to many recipients.

Parameters:
server - the smtp host to send the message.
from - the 'from' email address
to - target recipients' emails
cc - carbon copy reciepients' emails
bcc - blind carbon copy recipients' emails
subject - the message subject
body - the email body
encoding - encoding for the message
isHtml - the format indicator: true for HTML, false for text
Throws:
java.lang.Exception

sendEmail

public static void sendEmail(java.lang.String server,
                             java.lang.String from,
                             java.lang.String[] to,
                             java.lang.String[] cc,
                             java.lang.String[] bcc,
                             java.lang.String subject,
                             java.lang.String body,
                             java.lang.String encoding,
                             boolean isHtml,
                             int priority)
                      throws java.lang.Exception
Sends an email to many recipients with the specified priority.

Parameters:
server - the smtp host to send the message.
from - the 'from' email address
to - target recipients' emails
cc - carbon copy reciepients' emails
bcc - blind carbon copy recipients' emails
subject - the message subject
body - the email body
encoding - encoding for the message
isHtml - the format indicator: true for HTML, false for text
priority - the email priority; one of the PRIORITY_XXXconstants
Throws:
java.lang.Exception