public class SendMailSession
extends java.lang.Object
| Modifier and Type | Class and Description | 
|---|---|
static class  | 
jodd.mail.MailSession.Defaults  | 
| Modifier and Type | Field and Description | 
|---|---|
protected javax.mail.Service | 
service  | 
| Constructor and Description | 
|---|
SendMailSession(javax.mail.Session session,
               javax.mail.Transport transport)
Creates new mail session. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
close()
Closes session. 
 | 
protected javax.mail.internet.MimeBodyPart | 
createAttachmentBodyPart(EmailAttachment<? extends javax.activation.DataSource> attachment)
Creates attachment body part. 
 | 
protected javax.mail.internet.MimeMessage | 
createMessage(Email email)
Creates new  
MimeMessage from an Email. | 
protected java.util.List<EmailAttachment<? extends javax.activation.DataSource>> | 
filterEmbeddedAttachments(java.util.List<EmailAttachment<? extends javax.activation.DataSource>> attachments,
                         EmailMessage emailMessage)
 | 
javax.mail.Transport | 
getService()
Returns the  
Service. | 
javax.mail.Session | 
getSession()
Returns the  
Session. | 
boolean | 
isConnected()
Returns  
true if mail session is still connected. | 
void | 
open()
Opens session. 
 | 
java.lang.String | 
sendMail(Email email)
Prepares message and sends it. 
 | 
protected static void | 
setupSystemMailProperties()
Setups the system email properties. 
 | 
public SendMailSession(javax.mail.Session session,
                       javax.mail.Transport transport)
session - Sessiontransport - Transportpublic javax.mail.Transport getService()
Service.Service.public java.lang.String sendMail(Email email)
email - Email to send.protected javax.mail.internet.MimeMessage createMessage(Email email) throws javax.mail.MessagingException
MimeMessage from an Email.protected javax.mail.internet.MimeBodyPart createAttachmentBodyPart(EmailAttachment<? extends javax.activation.DataSource> attachment) throws javax.mail.MessagingException
attachment - Body part EmailAttachment.MimeBodyPart which represents body part attachment.javax.mail.MessagingException - if there is a failure.protected java.util.List<EmailAttachment<? extends javax.activation.DataSource>> filterEmbeddedAttachments(java.util.List<EmailAttachment<? extends javax.activation.DataSource>> attachments, EmailMessage emailMessage)
List of embedded EmailAttachments for given EmailMessage.
 This will remove the embedded attachments from the List and return them in a new List.attachments - List of attachments to search for in emailMessage.emailMessage - EmailMessage to see if attachment is embedded into.List of embedded EmailAttachments; otherwise, returns empty List.protected static void setupSystemMailProperties()
public void open()
public void close()
close in interface java.lang.AutoCloseablepublic boolean isConnected()
true if mail session is still connected.true if mail session is still connected.public javax.mail.Session getSession()
Session.Session.Copyright © 2003-present Jodd Team