public class MailUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
MAIL_REGEX |
static String |
NO_BODY |
static String |
NO_SUBJECT |
Constructor and Description |
---|
MailUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addAttachments(String token,
Mail mail,
com.auxilii.msgparser.Message msg,
String userId)
Add attachments to an imported mail.
|
static void |
addAttachments(String token,
Mail mail,
javax.mail.Part p,
String userId)
Add attachments to an imported mail.
|
static String |
addressToString(javax.mail.Address a)
Conversion from Address to String.
|
static boolean |
checkRules(Mail mail,
Set<MailFilterRule> filterRules)
Check mail import rules
|
static javax.mail.internet.MimeMessage |
create(String token,
Mail mail)
Create a mail from a Mail object
|
static void |
forwardMail(String token,
String fromAddress,
Collection<String> toAddress,
String message,
String mailId)
Forward a mail in the repository.
|
static void |
forwardMail(String token,
String fromAddress,
String toAddress,
String message,
String mailPath)
Forward a mail in the repository.
|
static Properties |
getProperties()
Common properties for all mail sessions.
|
static String |
getTinyUrl(String fullUrl)
User tinyurl service as url shorter Depends on commons-httpclient:commons-httpclient:jar:3.0 because of
org.apache.jackrabbit:jackrabbit-webdav:jar:1.6.4
|
static String |
getUserMailPath(String user) |
static void |
importMail(String token,
String mailPath,
boolean grouping,
javax.mail.Folder folder,
javax.mail.Message msg,
MailAccount ma,
Mail mail)
Import mail into OpenKM repository
|
static String |
importMessages(String token,
MailAccount ma)
Import messages
http://www.jguru.com/faq/view.jsp?
|
static String |
mail2html(Mail mail)
Generate HTML with mail object data and contents
|
static Mail |
messageToMail(javax.mail.Message msg)
Convert Mime Message to Mail
|
static Mail |
messageToMail(com.auxilii.msgparser.Message msg)
Convert Outlook Message to Mail
|
static List<String> |
parseMailList(String mails)
Convert string with mails to list.
|
static void |
sendDocument(String fromAddress,
List<String> toAddress,
String subject,
String text,
String docPath)
Send document to non-registered OpenKM users
|
static void |
sendDocuments(String fromAddress,
List<String> toAddress,
String subject,
String text,
List<String> docsPath)
Send document to non-registered OpenKM users
|
static void |
sendMessage(Collection<String> toAddress,
String subject,
String content)
Send mail without FROM addresses.
|
static void |
sendMessage(String fromAddress,
List<String> toAddress,
String subject,
String content)
Send mail without FROM addresses.
|
static void |
sendMessage(String toAddress,
String subject,
String content)
Send mail without FROM addresses.
|
static void |
sendMessage(String fromAddress,
String toAddress,
String subject,
String content)
Send mail without FROM addresses.
|
static void |
testConnection(MailAccount ma)
Test IMAP connection
|
public static final String NO_SUBJECT
public static final String NO_BODY
public static final String MAIL_REGEX
public static Properties getProperties()
public static void sendMessage(Collection<String> toAddress, String subject, String content) throws javax.mail.MessagingException
toAddress
- Destination addresses.subject
- The mail subject.content
- The mail body.javax.mail.MessagingException
- If there is any error.public static void sendMessage(String toAddress, String subject, String content) throws javax.mail.MessagingException
toAddress
- Destination addresses.subject
- The mail subject.content
- The mail body.javax.mail.MessagingException
- If there is any error.public static void sendMessage(String fromAddress, List<String> toAddress, String subject, String content) throws javax.mail.MessagingException
toAddress
- Destination addresses.subject
- The mail subject.content
- The mail body.javax.mail.MessagingException
- If there is any error.public static void sendMessage(String fromAddress, String toAddress, String subject, String content) throws javax.mail.MessagingException
toAddress
- Destination addresses.subject
- The mail subject.content
- The mail body.javax.mail.MessagingException
- If there is any error.public static void sendDocument(String fromAddress, List<String> toAddress, String subject, String text, String docPath) throws javax.mail.MessagingException, PathNotFoundException, AccessDeniedException, RepositoryException, IOException, DatabaseException
toAddress
- Destination addresses.subject
- The mail subject.text
- The mail body.javax.mail.MessagingException
- If there is any error.PathNotFoundException
AccessDeniedException
RepositoryException
IOException
DatabaseException
public static void sendDocuments(String fromAddress, List<String> toAddress, String subject, String text, List<String> docsPath) throws javax.mail.MessagingException, PathNotFoundException, AccessDeniedException, RepositoryException, IOException, DatabaseException
toAddress
- Destination addresses.subject
- The mail subject.text
- The mail body.javax.mail.MessagingException
- If there is any error.PathNotFoundException
AccessDeniedException
RepositoryException
IOException
DatabaseException
public static void forwardMail(String token, String fromAddress, String toAddress, String message, String mailPath) throws javax.mail.MessagingException, PathNotFoundException, AccessDeniedException, RepositoryException, IOException, DatabaseException
token
- Authentication token.fromAddress
- Origin address.toAddress
- Destination addresses.mailPath
- Path of the mail to be forwarded.javax.mail.MessagingException
- If there is any error.PathNotFoundException
AccessDeniedException
RepositoryException
IOException
DatabaseException
public static void forwardMail(String token, String fromAddress, Collection<String> toAddress, String message, String mailId) throws javax.mail.MessagingException, PathNotFoundException, AccessDeniedException, RepositoryException, IOException, DatabaseException
token
- Authentication token.fromAddress
- Origin address.toAddress
- Destination addresses.mailId
- Path of the mail to be forwarded or its UUID.javax.mail.MessagingException
- If there is any error.PathNotFoundException
AccessDeniedException
RepositoryException
IOException
DatabaseException
public static javax.mail.internet.MimeMessage create(String token, Mail mail) throws javax.mail.MessagingException, PathNotFoundException, AccessDeniedException, RepositoryException, IOException, DatabaseException
javax.mail.MessagingException
PathNotFoundException
AccessDeniedException
RepositoryException
IOException
DatabaseException
public static String importMessages(String token, MailAccount ma) throws PathNotFoundException, ItemExistsException, VirusDetectedException, AccessDeniedException, RepositoryException, DatabaseException, UserQuotaExceededException, ExtensionException, AutomationException
public static Mail messageToMail(javax.mail.Message msg) throws javax.mail.MessagingException, IOException
javax.mail.MessagingException
IOException
public static Mail messageToMail(com.auxilii.msgparser.Message msg) throws javax.mail.MessagingException, IOException
javax.mail.MessagingException
IOException
public static void importMail(String token, String mailPath, boolean grouping, javax.mail.Folder folder, javax.mail.Message msg, MailAccount ma, Mail mail) throws DatabaseException, RepositoryException, AccessDeniedException, ItemExistsException, PathNotFoundException, javax.mail.MessagingException, VirusDetectedException, UserQuotaExceededException, IOException, ExtensionException, AutomationException
public static boolean checkRules(Mail mail, Set<MailFilterRule> filterRules)
public static void addAttachments(String token, Mail mail, javax.mail.Part p, String userId) throws javax.mail.MessagingException, IOException, UnsupportedMimeTypeException, FileSizeExceededException, UserQuotaExceededException, VirusDetectedException, ItemExistsException, PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException, ExtensionException, AutomationException
public static String addressToString(javax.mail.Address a)
public static String getTinyUrl(String fullUrl) throws org.apache.commons.httpclient.HttpException, IOException
org.apache.commons.httpclient.HttpException
IOException
public static void testConnection(MailAccount ma) throws IOException
IOException
public static void addAttachments(String token, Mail mail, com.auxilii.msgparser.Message msg, String userId) throws DatabaseException, RepositoryException, PathNotFoundException, ItemExistsException, VirusDetectedException, UserQuotaExceededException, UnsupportedMimeTypeException, ExtensionException, AccessDeniedException, IOException, AutomationException, FileSizeExceededException
public static String mail2html(Mail mail) throws ConversionException
ConversionException
Copyright © 2016. All rights reserved.