com.jfw.mail
Class SendEmail

java.lang.Object
  extended by com.jfw.mail.SendEmail

public final class SendEmail
extends java.lang.Object

Send an email. Use class SendEmailThread for send the email.


Field Summary
static java.lang.String MIME_SUBTYPE_HTML
          The MIME subtype for html.
static java.lang.String MIME_SUBTYPE_PLAIN
          The MIME subtype for plain.
 
Constructor Summary
SendEmail()
          Create an instance using default server parameters from jfw.properties.
SendEmail(java.lang.String host)
          Create an instance.
SendEmail(java.lang.String host, java.lang.String username, java.lang.String password)
          Create an instance.
 
Method Summary
 void send(java.lang.String from, java.util.ArrayList to, java.util.ArrayList cc, java.util.ArrayList bcc, java.lang.String object, java.lang.String text)
          Send mail to more mail addresses, in cc and bcc.
 void send(java.lang.String from, java.util.ArrayList to, java.util.ArrayList cc, java.lang.String object, java.lang.String text)
          Send mail to more mail addresses.
 void send(java.lang.String from, java.util.ArrayList to, java.lang.String object, java.lang.String text)
          Send mail to more mail addresses.
 void send(java.lang.String from, java.lang.String to, java.util.ArrayList cc, java.lang.String object, java.lang.String text)
          Send mail to a single mail address.
 void send(java.lang.String from, java.lang.String to, java.lang.String object, java.lang.String text)
          Send mail to a single mail address.
 void setCharsetEncoding(java.lang.String charsetEncoding)
          Set attribute subcontentType.
 void setContentType(java.lang.String subcontentType)
          Set attribute subcontentType.
 void setDebug(boolean isDebug)
          Set attribute isDebug.
 void setIsSecure(boolean isSecure)
          Set attribute isSecure.
 void setPort(java.lang.String port)
          Set attribute port.
 void setWaitSend(boolean waitSend)
          Set attribute waitSend.
 java.lang.String toString()
          Return log informations relative of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MIME_SUBTYPE_PLAIN

public static final java.lang.String MIME_SUBTYPE_PLAIN
The MIME subtype for plain.

See Also:
Constant Field Values

MIME_SUBTYPE_HTML

public static final java.lang.String MIME_SUBTYPE_HTML
The MIME subtype for html.

See Also:
Constant Field Values
Constructor Detail

SendEmail

public SendEmail()
Create an instance using default server parameters from jfw.properties.


SendEmail

public SendEmail(java.lang.String host)
Create an instance.

Parameters:
host - mail server to use for send the email.

SendEmail

public SendEmail(java.lang.String host,
                 java.lang.String username,
                 java.lang.String password)
Create an instance.

Parameters:
host - mail server to use for send the email.
Method Detail

setContentType

public void setContentType(java.lang.String subcontentType)
Set attribute subcontentType.
Default value is MIME_SUBTYPE_PLAIN.

Parameters:
subcontentType - subcontent type to use.

setCharsetEncoding

public void setCharsetEncoding(java.lang.String charsetEncoding)
Set attribute subcontentType.
Default value is ISO-8859-1.

Parameters:
charsetEncoding - content type to use.

setDebug

public void setDebug(boolean isDebug)
Set attribute isDebug. Default value is true.

Parameters:
isDebug - debug mode.

setPort

public void setPort(java.lang.String port)
Set attribute port.

Parameters:
port - the port.

setIsSecure

public void setIsSecure(boolean isSecure)
Set attribute isSecure.

Parameters:
isSecure - set SSL use for connection.

setWaitSend

public void setWaitSend(boolean waitSend)
Set attribute waitSend. Default value is false: the mail is send asynchronously.

Parameters:
waitSend - send email mode.

send

public void send(java.lang.String from,
                 java.lang.String to,
                 java.lang.String object,
                 java.lang.String text)
          throws JFWGenericException
Send mail to a single mail address.

Parameters:
from - mail address of sender.
to - mail address of receiver.
object - mail object.
text - mail text.
Throws:
JFWGenericException

send

public void send(java.lang.String from,
                 java.util.ArrayList to,
                 java.lang.String object,
                 java.lang.String text)
          throws JFWGenericException
Send mail to more mail addresses.

Parameters:
from - mail address of sender.
to - mail addresses of receivers.
object - mail object.
text - mail text.
Throws:
JFWGenericException

send

public void send(java.lang.String from,
                 java.lang.String to,
                 java.util.ArrayList cc,
                 java.lang.String object,
                 java.lang.String text)
          throws JFWGenericException
Send mail to a single mail address.

Parameters:
from - mail address of sender.
to - mail address of receiver.
cc - mail addresses of Cc.
object - mail object.
text - mail text.
Throws:
JFWGenericException

send

public void send(java.lang.String from,
                 java.util.ArrayList to,
                 java.util.ArrayList cc,
                 java.lang.String object,
                 java.lang.String text)
          throws JFWGenericException
Send mail to more mail addresses.

Parameters:
from - mail address of sender.
to - mail addresses of receivers.
cc - mail addresses of Cc.
object - mail object.
text - mail text.
Throws:
JFWGenericException

send

public void send(java.lang.String from,
                 java.util.ArrayList to,
                 java.util.ArrayList cc,
                 java.util.ArrayList bcc,
                 java.lang.String object,
                 java.lang.String text)
          throws JFWGenericException
Send mail to more mail addresses, in cc and bcc.

Parameters:
from - mail address of sender.
to - mail addresses of receivers.
cc - mail addresses of Cc.
bcc - mail addresses of Bcc.
object - mail object.
text - mail text.
Throws:
JFWGenericException

toString

public java.lang.String toString()
Return log informations relative of the object.

Overrides:
toString in class java.lang.Object
Returns:
log informations relative of the object.