public class Email
extends java.lang.Object
try { Email email = new Email(fromName, fromEmail, toEmail,subject, message, type); } catch (Throwable e) { //Do something }
Constructor and Description |
---|
Email(java.lang.String fromName,
java.lang.String fromEmail,
java.lang.String toEmail,
java.lang.String subject,
java.lang.String message,
java.lang.String type)
Constructor for the email to one recipient
|
Modifier and Type | Method and Description |
---|---|
void |
addAttachment(java.lang.String filename,
java.lang.String file)
Add attachment to the email
|
void |
addRecipient(java.lang.String emailAddress)
Add a recipient
|
void |
createMessage(java.lang.String fromName,
java.lang.String fromEmail,
java.lang.String subject,
java.lang.String message,
java.lang.String type)
Create an email message
|
com.objectplanet.survey.util.Email |
getEmailObject()
Gets the save value
|
java.lang.String |
getEmailType()
Gets the email type
|
long |
getFailedId()
Get the failed id.
|
boolean |
getSave()
Gets the save value
|
void |
setEmailType(java.lang.String emailType)
Set the id of the email if failed
|
void |
setFailedId(long failedId)
Set the id of the email if failed
|
void |
setSave(boolean saveToFailedEmails)
Set the save variable
|
java.lang.String |
toLogString()
Return string object for this email (used for logging)
|
public Email(java.lang.String fromName, java.lang.String fromEmail, java.lang.String toEmail, java.lang.String subject, java.lang.String message, java.lang.String type) throws EmailCreationException, javax.mail.internet.AddressException
fromName
- Who sends the message (name)fromEmail
- Who sends the message(email address)toEmail
- Recipients' emailsubject
- The subject of the emailmessage
- The body of the messagetype
- The type of the message (text/plain or text/html)EmailCreationException
- Error during email creationjavax.mail.internet.AddressException
- Error during recipient creationpublic void createMessage(java.lang.String fromName, java.lang.String fromEmail, java.lang.String subject, java.lang.String message, java.lang.String type) throws com.objectplanet.survey.util.EmailCreationException
fromName
- Who sends the message (name)fromEmail
- Who sends the message(email address)subject
- The subject of the emailmessage
- The body of the messagetype
- The type of the message body (text/plain or text/html)EmailCreationException
- If errorcom.objectplanet.survey.util.EmailCreationException
public void addAttachment(java.lang.String filename, java.lang.String file) throws java.io.IOException, javax.mail.MessagingException
filename
- Visible file name ("myFile.txt")file
- File pathjava.io.IOException
- IOExceptionjavax.mail.MessagingException
- MessagingExceptionpublic void addRecipient(java.lang.String emailAddress) throws javax.mail.internet.AddressException
newRecipient
- Recipient to addjavax.mail.internet.AddressException
- Error during recipient creationpublic java.lang.String toLogString()
public void setEmailType(java.lang.String emailType)
emailType
- The new email type (text/plain or text/html)public void setFailedId(long failedId)
failedId
- The new idpublic void setSave(boolean saveToFailedEmails)
saveToFailedEmails
- True if the email should be saved to failed
mails in case it failspublic long getFailedId()
public java.lang.String getEmailType()
public boolean getSave()
public com.objectplanet.survey.util.Email getEmailObject()
Built on January 16 2019