net.sourceforge.jaulp.email
Class SendEmail

java.lang.Object
  extended by net.sourceforge.jaulp.email.SendEmail

public class SendEmail
extends java.lang.Object

Helper-class for sending emails.

Author:
Asterios Raptis

Constructor Summary
SendEmail()
          The Constructor.
SendEmail(java.util.Properties properties)
          The Constructor.
 
Method Summary
protected  javax.mail.Session getSession()
          Gets the Session-object.
 boolean isDebug()
          Checks the debug flag if it is true or false.
 java.lang.String sendEmail(EmailAttachments emailAttachments)
          Sends the EmailMessage thats wrappes from the EmailAttachments.
 java.lang.String sendEmail(EmailMessage emailMessage)
          Sends the given EmailMessage.
 java.lang.String sendEmail(java.lang.String to, java.lang.String from, java.lang.String subject, java.lang.String message)
          Sends a simple email.
 void setDebug(boolean debug)
          Sets the debug flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SendEmail

public SendEmail()
The Constructor.


SendEmail

public SendEmail(java.util.Properties properties)
The Constructor.

Parameters:
properties - the properties
Method Detail

getSession

protected javax.mail.Session getSession()
Gets the Session-object.

Returns:
's the Session-object.

isDebug

public boolean isDebug()
Checks the debug flag if it is true or false.

Returns:
true, if the debug flag is true otherwise false.

sendEmail

public java.lang.String sendEmail(EmailAttachments emailAttachments)
                           throws javax.mail.MessagingException
Sends the EmailMessage thats wrappes from the EmailAttachments.

Parameters:
emailAttachments - The EmailAttachments who wrappes the EmailMessage.
Returns:
's the messageid.
Throws:
javax.mail.MessagingException - if an error occurs.

sendEmail

public java.lang.String sendEmail(EmailMessage emailMessage)
                           throws javax.mail.MessagingException
Sends the given EmailMessage.

Parameters:
emailMessage - The EmailMessage to send.
Returns:
's the messageid.
Throws:
javax.mail.MessagingException - if an error occurs.

sendEmail

public java.lang.String sendEmail(java.lang.String to,
                                  java.lang.String from,
                                  java.lang.String subject,
                                  java.lang.String message)
                           throws javax.mail.internet.AddressException,
                                  java.io.UnsupportedEncodingException,
                                  javax.mail.MessagingException
Sends a simple email.

Parameters:
to - The to Address.
from - The from Address.
subject - The subject from the email.
message - The Message from the email.
Returns:
's the messageid.
Throws:
javax.mail.MessagingException - if an error occurs by sending the message.
java.io.UnsupportedEncodingException - if an error occurs by encoding.
javax.mail.internet.AddressException - the address exception

setDebug

public void setDebug(boolean debug)
Sets the debug flag.

Parameters:
debug - The debug flag to set.


Copyright © 2010. All Rights Reserved.