1 Mailer

Class Ax.mail.Mailer


Constructor Summary

MethodDescription
JSMailer()
JSMailer(String transport)

Method Summary

Modifier and TypeMethodDescription
boolean isValid(String address)Simple Java Mail can validate your email addresses.
String send(JSMailerMessage mail)
String send(JSMailerMessage mail, boolean async)Sends the email getting the generated email id after sending like
JSMailer setDebug()
JSMailer setProxyHost(String host)
JSMailer setProxyPassword(String password)
JSMailer setProxyPort(int port)
JSMailer setProxyUser(String username)
JSMailer setSMTPPassword(String password)
JSMailer setSMTPServer(String host, int port)
JSMailer setSMTPUsername(String username)
JSMailer setSessionTimeout(int millis)
JSMailer setTrustAllSSLHosts()
JSMailer setTrustSSLHosts(String[] hosts)
void testConnection()If you just want to do a connection test using your current configuration, including transport strategy and (authenticated) proxy, Simple Java Mail got you covered.
JSMailer validate(JSMailerMessage email)

Method Detail

JSMailer

 JSMailer()

JSMailer

 JSMailer(String transport)
Parameters:
transport - 

isValid

boolean isValid(String address)
Info:
Simple Java Mail can validate your email addresses. It's not just a simple regex check, but a complete and robust full validation against RFC-2822. It does this by including email-rfc2822-validator in the library. Address validation is performed automatically when sending emails, but you can also directly perform validations.
Parameters:
address - 
Returns:

send

                        String send(JSMailerMessage mail)
Parameters:
mail - 
Returns:

send

                        String send(JSMailerMessage mail, boolean async)
Info:
Sends the email getting the generated email id after sending like
Parameters:
mail - 
async - 
Returns:

setDebug

                        JSMailer setDebug()
Returns:

setProxyHost

                        JSMailer setProxyHost(String host)
Parameters:
host - 
Returns:

setProxyPassword

                        JSMailer setProxyPassword(String password)
Parameters:
password - 
Returns:

setProxyPort

                        JSMailer setProxyPort(int port)
Parameters:
port - 
Returns:

setProxyUser

                        JSMailer setProxyUser(String username)
Parameters:
username - 
Returns:

setSMTPPassword

                        JSMailer setSMTPPassword(String password)
Parameters:
password - 
Returns:

setSMTPServer

                        JSMailer setSMTPServer(String host, int port)
Parameters:
host - 
port - 
Returns:

setSMTPUsername

                        JSMailer setSMTPUsername(String username)
Parameters:
username - 
Returns:

setSessionTimeout

                        JSMailer setSessionTimeout(int millis)
Parameters:
millis - 
Returns:

setTrustAllSSLHosts

                        JSMailer setTrustAllSSLHosts()
Returns:

setTrustSSLHosts

                        JSMailer setTrustSSLHosts(String[] hosts)
Parameters:
hosts - 
Returns:

testConnection

void testConnection()
Info:
If you just want to do a connection test using your current configuration, including transport strategy and (authenticated) proxy, Simple Java Mail got you covered.

validate

                        JSMailer validate(JSMailerMessage email)
Parameters:
email - 
Returns:

2 MailerMessage

Class Ax.mail.MailerMessage


Constructor Summary

MethodDescription
JSMailerMessage()

Method Summary

Modifier and TypeMethodDescription
JSMailerMessage addAttachment(String name, Object data, String contentType)
JSMailerMessage addAttachment(String name, JSFile file)
JSMailerMessage addAttachment(JDBCBlobJMEM data)
JSMailerMessage addEmbeddedImage(String name, Object data, String contentType)
JSMailerMessage addEmbeddedImage(String name, JSFile file)
JSMailerMessage addEmbeddedImage(JDBCBlobJMEM data)
JSMailerMessage addHeader(String name, Object value)
JSMailerMessage bcc(String oneOrMoreAddresses)
JSMailerMessage bcc(String name, String address)
JSMailerMessage bccWithDefaultName(String name, String address)what about a group with one deviating name? String list = "bob@sweets.
JSMailerMessage cc(String oneOrMoreAddresses)
JSMailerMessage cc(String name, String address)
JSMailerMessage ccWithDefaultName(String name, String address)what about a group with one deviating name? String list = "bob@sweets.
JSMailerMessage from(String fromAddress)Set the email message "from" field.
JSMailerMessage from(String fromName, String fromAddress)Set the email message "from" field.
String getMessageContent(String[] ignoreList)Output the message as an RFC 822 format stream, without specified headers.
JSMailerMessage reply(String replyToAddress)Set the email message "reply to" field.
JSMailerMessage reply(String replyToName, String replyToAddress)Set the email message "reply to" field.
JSMailerMessage setDispositionNotificationTo()
JSMailerMessage setDispositionNotificationTo(String name, String address)
JSMailerMessage setHtml(String text)
JSMailerMessage setMessageId(String id)Message id's are normally generated by the underlying JavaMail framework, but you can provide your own if required.
JSMailerMessage setReturnReceiptTo()
JSMailerMessage setReturnReceiptTo(String name, String address)
JSMailerMessage setText(String text)
JSMailerMessage subject(String subject)
JSMailerMessage to(String oneOrMoreAddresses)
JSMailerMessage to(String name, String address)
MimeMessage toMimeMessage()
JSMailerMessage toWithDefaultName(String name, String address)what about a group with one deviating name? String list = "bob@sweets.

Method Detail

JSMailerMessage

 JSMailerMessage()

addAttachment

                        JSMailerMessage addAttachment(String name, Object data, String contentType)
Parameters:
name - 
data - 
contentType - 
Returns:

addAttachment

                        JSMailerMessage addAttachment(String name, JSFile file)
Parameters:
name - 
file - 
Returns:

addAttachment

                        JSMailerMessage addAttachment(JDBCBlobJMEM data)
Parameters:
data - 
Returns:

addEmbeddedImage

                        JSMailerMessage addEmbeddedImage(String name, Object data, String contentType)
Parameters:
name - 
data - 
contentType - 
Returns:

addEmbeddedImage

                        JSMailerMessage addEmbeddedImage(String name, JSFile file)
Parameters:
name - 
file - 
Returns:

addEmbeddedImage

                        JSMailerMessage addEmbeddedImage(JDBCBlobJMEM data)
Parameters:
data - 
Returns:

addHeader

                        JSMailerMessage addHeader(String name, Object value)
Parameters:
name - 
value - 
Returns:

bcc

                        JSMailerMessage bcc(String oneOrMoreAddresses)
Parameters:
oneOrMoreAddresses - 
Returns:

bcc

                        JSMailerMessage bcc(String name, String address)
Parameters:
name - 
address - 
Returns:

bccWithDefaultName

                        JSMailerMessage bccWithDefaultName(String name, String address)
Info:
what about a group with one deviating name? String list = "bob@sweets.com, gene@sweets.com; Security Group
Parameters:
name - 
address - 
Returns:

cc

                        JSMailerMessage cc(String oneOrMoreAddresses)
Parameters:
oneOrMoreAddresses - 
Returns:

cc

                        JSMailerMessage cc(String name, String address)
Parameters:
name - 
address - 
Returns:

ccWithDefaultName

                        JSMailerMessage ccWithDefaultName(String name, String address)
Info:
what about a group with one deviating name? String list = "bob@sweets.com, gene@sweets.com; Security Group
Parameters:
name - 
address - 
Returns:

from

                        JSMailerMessage from(String fromAddress)
Info:
Set the email message "from" field. Should receive a valid email address.
Parameters:
fromAddress - 
Returns:

from

                        JSMailerMessage from(String fromName, String fromAddress)
Info:
Set the email message "from" field. Used to specify both name and address. Example: from("John Smith", "js@example.com") John Smith
Parameters:
fromName - 
fromAddress - 
Returns:

getMessageContent

                        String getMessageContent(String[] ignoreList)
Info:
Output the message as an RFC 822 format stream, without specified headers. If the saved flag is not set, the saveChanges method is called. If the modified flag is not set and the content array is not null, the content array is written directly, after writing the appropriate message headers.
Parameters:
ignoreList - 
Returns:

reply

                        JSMailerMessage reply(String replyToAddress)
Info:
Set the email message "reply to" field. Should receive a valid email address.
Parameters:
replyToAddress - 
Returns:

reply

                        JSMailerMessage reply(String replyToName, String replyToAddress)
Info:
Set the email message "reply to" field. Used to specify both name and address. Example: reply("John Smith", "js@example.com") John Smith
Parameters:
replyToName - 
replyToAddress - 
Returns:

setDispositionNotificationTo

                        JSMailerMessage setDispositionNotificationTo()
Returns:

setDispositionNotificationTo

                        JSMailerMessage setDispositionNotificationTo(String name, String address)
Parameters:
name - 
address - 
Returns:

setHtml

                        JSMailerMessage setHtml(String text)
Parameters:
text - 
Returns:

setMessageId

                        JSMailerMessage setMessageId(String id)
Info:
Message id's are normally generated by the underlying JavaMail framework, but you can provide your own if required. Just make sure your own id's conform to the rfc5322 msg-id format standard like
Parameters:
id - 
Returns:

setReturnReceiptTo

                        JSMailerMessage setReturnReceiptTo()
Returns:

setReturnReceiptTo

                        JSMailerMessage setReturnReceiptTo(String name, String address)
Parameters:
name - 
address - 
Returns:

setText

                        JSMailerMessage setText(String text)
Parameters:
text - 
Returns:

subject

                        JSMailerMessage subject(String subject)
Parameters:
subject - 
Returns:

to

                        JSMailerMessage to(String oneOrMoreAddresses)
Parameters:
oneOrMoreAddresses - 
Returns:

to

                        JSMailerMessage to(String name, String address)
Parameters:
name - 
address - 
Returns:

toMimeMessage

                        MimeMessage toMimeMessage()
Returns:

toWithDefaultName

                        JSMailerMessage toWithDefaultName(String name, String address)
Info:
what about a group with one deviating name? String list = "bob@sweets.com, gene@sweets.com; Security Group
Parameters:
name - 
address - 
Returns:

3 Store

Class Ax.mail.Store


Java Mail comes with Provider implementations for POP3 and IMAP, and the secure versions of those as POP3S and IMAPS. IMAP protocol is more advanced than POP. With IMAP, you can talk back to the server and sync your changes automatically.

Constructor Summary

MethodDescription
JSMailStore(String protocol)The constructor receives a parameter providing mail communication protocol.
JSMailStore(String protocol, Consumer<Properties> configurator)The constructor receives a parameter providing mail communication protocol.

Method Summary

Modifier and TypeMethodDescription
void close()Closes mail connection.
JSMailStore connect(String host, String user, String password)Connects to host server using protocol defined in constructor.
JSMailStore connect(String host, int port, String user, String password)Connects to host server using protocol defined in constructor.
JSMailFolder getDefaultFolder()Gets default folder in Server.
JSMailFolder getFolder(String folder)Gets e-mail folder class pointing to folder passe as parameter.
List getPersonalNamespaces()Gets personal namespaces.
List getSharedNamespaces()Gets shared namespaces.
String getURLName()Gets connection URL.
List listFolders()Gets folders in Server.

Method Detail

JSMailStore

 JSMailStore(String protocol)
Info:
The constructor receives a parameter providing mail communication protocol. Protocols provided are: pop, pops, imap and imaps.
Parameters:
protocol - communication protocol: pop, pops, imap or imaps

Example
Copy
new Ax.mail.Store("imaps");

JSMailStore

 JSMailStore(String protocol, Consumer<Properties> configurator)
Info:
The constructor receives a parameter providing mail communication protocol. Protocols provided are: pop, pops, imap and imaps.
Parameters:
protocol - 
configurator - 

Example
Copy
new Ax.mail.Store("imaps", properties => {
 properties.put("debug", "false");
 });

close

void close()
Info:
Closes mail connection.

connect

                        JSMailStore connect(String host, String user, String password)
Info:
Connects to host server using protocol defined in constructor.
Parameters:
host - host server
user - user connecting to server
password - password of user
Returns:
a Mail Store object that defines a connection to a mail server

connect

                        JSMailStore connect(String host, int port, String user, String password)
Info:
Connects to host server using protocol defined in constructor.
Parameters:
host - host server
port - connection port
user - user connecting to server
password - password of user
Returns:
a Mail Store object that defines a connection to a mail server

getDefaultFolder

                        JSMailFolder getDefaultFolder()
Info:
Gets default folder in Server.
Returns:
default folder in Server

getFolder

                        JSMailFolder getFolder(String folder)
Info:
Gets e-mail folder class pointing to folder passe as parameter.
Parameters:
folder - folder name
Returns:
folder

getPersonalNamespaces

                        List getPersonalNamespaces()
Info:
Gets personal namespaces.
Returns:
list of folers of personal namespaces

getSharedNamespaces

                        List getSharedNamespaces()
Info:
Gets shared namespaces.
Returns:
list of folders of shared namespaces

getURLName

                        String getURLName()
Info:
Gets connection URL.
Returns:
string with url name

listFolders

                        List listFolders()
Info:
Gets folders in Server.
Returns:
list of the folders in Server

4 Message

Class Ax.mail.Message


A wrapper around javax.mail.Message Rgistered as Ax.mail.Message

Constructor Summary

MethodDescription
JSMailMessage(Message message)Constructor from a Message object
JSMailMessage(String content)Construct a Message from content generated via getMessageContent().
JSMailMessage(Message message, boolean markSeen)Constructor from a Message object

Method Summary

Modifier and TypeMethodDescription
void __loadMessageParts(Object content, int deep, ArrayList<JSBlob> list)
String getAllRecipients()
Address[] getAllRecipientsAddress()
String getBCC()
Address[] getBCCAddress()
String getCC()
Address[] getCCAddress()
Object getContent()Return the content as a Java object.
String getContentType()
String getDescription()
String getDisposition()
String getFileName()
String getFrom()Get from part of message.
Address[] getFromAddress()Get from adrress of message.
String getMessageContent()Output a bytestream for this Part.
String getMessageContent(String[] ignoreList)Output the message as an RFC 822 format stream, without specified headers.
String getMessageContentHtml()
String getMessageContentText()
String getMessageID()the value of the "Message-ID" header field.
int getMessageNumber()Get the Message number for this Message.
ArrayList getMessageParts()
Date getReceivedDate()
String getReplyTo()
Address[] getReplyToAddress()
Date getSentDate()
int getSize()Return the size of the content of this part in bytes.
String getSubject()
String getTo()Get to part of message.
Address[] getToAddress()Get to address of message.
boolean isSet(Flag flag)Check whether the flag specified in the flag argument is set in this message.
void setFlag(Flag flag, boolean set)Set the specified flag on this message to the specified value.
JDBCBlob toBlob()Return the message as binary content (the full mail message).
String toString()Return string with info about sender, date of reception and subject.

Method Detail

JSMailMessage

 JSMailMessage(Message message)
Info:
Constructor from a Message object
Parameters:
message - Message object

JSMailMessage

 JSMailMessage(String content)
Info:
Construct a Message from content generated via getMessageContent().
Parameters:
content - 

JSMailMessage

 JSMailMessage(Message message, boolean markSeen)
Info:
Constructor from a Message object
Parameters:
message - message object
markSeen - true if marked as seen, false otherwise

__loadMessageParts

void __loadMessageParts(Object content, int deep, ArrayList<JSBlob> list)
Parameters:
content - 
deep - 
list - 

getAllRecipients

                        String getAllRecipients()
Returns:

getAllRecipientsAddress

                        Address[] getAllRecipientsAddress()
Returns:
the Address/InernetAddress

getBCC

                        String getBCC()
Returns:

getBCCAddress

                        Address[] getBCCAddress()
Returns:
the Address/InernetAddress

getCC

                        String getCC()
Returns:

getCCAddress

                        Address[] getCCAddress()
Returns:
the Address/InernetAddress

getContent

                        Object getContent()
Info:
Return the content as a Java object. The type of the returned object is of course dependent on the content itself. For example, the object returned for "text/plain" content is usually a String object. The object returned for a "multipart" content is always a Multipart subclass. For content-types that are unknown to the DataHandler system, an input stream is returned as the content This is a convenience method that just invokes the DataHandler's getContent() method
Returns:

getContentType

                        String getContentType()
Returns:

getDescription

                        String getDescription()
Returns:

getDisposition

                        String getDisposition()
Returns:

getFileName

                        String getFileName()
Returns:

getFrom

                        String getFrom()
Info:
Get from part of message.
Returns:
sender of this message

getFromAddress

                        Address[] getFromAddress()
Info:
Get from adrress of message.
Returns:
the Address/InernetAddress

getMessageContent

                        String getMessageContent()
Info:
Output a bytestream for this Part. This bytestream is typically an aggregration of the Part attributes and an appropriately encoded bytestream from its 'content'.
Returns:

getMessageContent

                        String getMessageContent(String[] ignoreList)
Info:
Output the message as an RFC 822 format stream, without specified headers. If the saved flag is not set, the saveChanges method is called. If the modified flag is not set and the content array is not null, the content array is written directly, after writing the appropriate message headers.
Parameters:
ignoreList - 
Returns:

getMessageContentHtml

                        String getMessageContentHtml()
Returns:

getMessageContentText

                        String getMessageContentText()
Returns:

getMessageID

                        String getMessageID()
Info:
the value of the "Message-ID" header field. Returns null if this field is unavailable or its value is absent.
Returns:
the message id

getMessageNumber

int getMessageNumber()
Info:
Get the Message number for this Message. A Message object's message number is the relative position of this Message in its Folder. Note that the message number for a particular Message can change during a session if other messages in the Folder are deleted and expunged. Valid message numbers start at 1. Messages that do not belong to any folder (like newly composed or derived messages) have 0 as their message number.
Returns:
the message number

getMessageParts

                        ArrayList getMessageParts()
Returns:

getReceivedDate

                        Date getReceivedDate()
Returns:

getReplyTo

                        String getReplyTo()
Returns:

getReplyToAddress

                        Address[] getReplyToAddress()
Returns:
the Address/InernetAddress

getSentDate

                        Date getSentDate()
Returns:

getSize

int getSize()
Info:
Return the size of the content of this part in bytes. Return -1 if the size cannot be determined. Note that the size may not be an exact measure of the content size and may or may not account for any transfer encoding of the content. The size is appropriate for display in a user interface to give the user a rough idea of the size of this part.
Returns:
size of content in bytes

getSubject

                        String getSubject()
Returns:

getTo

                        String getTo()
Info:
Get to part of message.
Returns:
recievers of message

getToAddress

                        Address[] getToAddress()
Info:
Get to address of message.
Returns:
the Address/InernetAddress

isSet

boolean isSet(Flag flag)
Info:
Check whether the flag specified in the flag argument is set in this message. Flags supported: Ax.mail.Message.SEEN, Ax.mail.Message.DRAFT, Ax.mail.Message.ANSWERED, Ax.mail.Message.DELETED, Ax.mail.Message.DRAFT, Ax.mail.Message.FLAGGED, Ax.mail.Message.RECENT The default implementation uses getFlags.
Parameters:
flag - flag object to check
Returns:
true if the flag is set on the message, false otherwise.

setFlag

void setFlag(Flag flag, boolean set)
Info:
Set the specified flag on this message to the specified value. This will result in a MessageChangedEvent being delivered to any MessageChangedListener registered on this Message's containing folder.
Parameters:
flag - flag to set
set - value to set the flag

toBlob

                        JDBCBlob toBlob()
Info:
Return the message as binary content (the full mail message).
Returns:
the message part as blob

toString

                        String toString()
Info:
Return string with info about sender, date of reception and subject.
Returns:
string with info about sender, date of reception and subject