Package anlavn.net
Class Email
java.lang.Object
anlavn.net.Email
The Email class supports create a SMTP to send email.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a host SMTP with full information.Create a host SMTP with full information.Create a host SMTP with full information. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanaddSetAttachments(String... setFile) Use this method to add attachments files to email.final booleanaddSetAttachments(Set<String> setFile) Use this method to add attachments files to email.final booleanUse this method to add recipients with type is BCC.final booleanUse this method to add recipients with type is BCC.final booleanUse this method to add recipients with type is CC.final booleanUse this method to add recipients with type is CC.final booleanUse this method to add recipients with type is TO.final booleanUse this method to add recipients with type is TO.final voidclear()Use this method to clear content email include title, content email, TO, CC, BCC, Attachments.final voidUse this method to clear set of attachments files.final voidUse this method to clear set of recipients with type is BCC.final voidUse this method to clear set of recipients with type is CC.final voidUse this method to clear set of recipients with type is TO.Use this method to get set of attachments files.Use this method to get set of recipients with type is BCC.getSetCC()Use this method to get set of recipients with type is CC.getSetTO()Use this method to get set of recipients with type is TO.final voidUse this method to send email to recipients.final voidUse this method to setup email content.
-
Constructor Details
-
Email
Create a host SMTP with full information.- Parameters:
hostEmail- is your SMTP email address.hostPass- is your SMTP server passwords.
-
Email
Create a host SMTP with full information.- Parameters:
hostEmail- is your SMTP email address.hostPass- is your SMTP server passwords.hostServer- is your SMTP server address. Default is 'smtp.gmail.com'.
-
Email
Create a host SMTP with full information.- Parameters:
hostEmail- is your SMTP email address.hostPass- is your SMTP server passwords.hostServer- is your SMTP server address. Default is 'smtp.gmail.com'.hostPort- is port of your SMTP server. Default is '587'.
-
-
Method Details
-
setEmail
Use this method to setup email content.- Parameters:
title- is Email Title.content- is Email Content.
-
addSetTO
Use this method to add recipients with type is TO.- Parameters:
setTO- is email address of recipients you want send to.- Returns:
trueif this set changed.
-
addSetTO
Use this method to add recipients with type is TO.- Parameters:
setTO- is email address of recipients you want send to.- Returns:
trueif this set changed.
-
getSetTO
Use this method to get set of recipients with type is TO.- Returns:
- set of address recipients with type is TO.
-
clearSetTO
public final void clearSetTO()Use this method to clear set of recipients with type is TO. -
addSetCC
Use this method to add recipients with type is CC.- Parameters:
setCC- is email address of recipients you want send carbon copy.- Returns:
trueif this set changed.
-
addSetCC
Use this method to add recipients with type is CC.- Parameters:
setCC- is email address of recipients you want send carbon copy.- Returns:
trueif this set changed.
-
getSetCC
Use this method to get set of recipients with type is CC.- Returns:
- set of recipients with type is CC.
-
clearSetCC
public final void clearSetCC()Use this method to clear set of recipients with type is CC. -
addSetBCC
Use this method to add recipients with type is BCC.- Parameters:
setBCC- is email address of recipients you want send blind carbon copy.- Returns:
trueif this set changed.
-
addSetBCC
Use this method to add recipients with type is BCC.- Parameters:
setBCC- is email address of recipients you want send blind carbon copy.- Returns:
trueif this set changed.
-
getSetBCC
Use this method to get set of recipients with type is BCC.- Returns:
- set of recipients with type is BCC.
-
clearSetBCC
public final void clearSetBCC()Use this method to clear set of recipients with type is BCC. -
addSetAttachments
Use this method to add attachments files to email.- Parameters:
setFile- is attachments files you want send.- Returns:
trueif this set changed.
-
addSetAttachments
Use this method to add attachments files to email.- Parameters:
setFile- is attachments files you want send.- Returns:
trueif this set changed.
-
getSetAttachments
Use this method to get set of attachments files.- Returns:
- set of attachments files.
-
clearSetAttachments
public final void clearSetAttachments()Use this method to clear set of attachments files. -
clear
public final void clear()Use this method to clear content email include title, content email, TO, CC, BCC, Attachments. -
sendEmail
public final void sendEmail() throws javax.mail.MessagingExceptionUse this method to send email to recipients.- Throws:
javax.mail.MessagingException- throw an exception if there is no internet connection or can't send email to the recipient.
-