Package ch.astorm.smtp4j.core
Class SmtpAttachment
- java.lang.Object
-
- ch.astorm.smtp4j.core.SmtpAttachment
-
public class SmtpAttachment extends java.lang.ObjectAttachment of anSmtpMessage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSmtpAttachment.StreamProviderProvides anInputStreamto read the attachment content.
-
Constructor Summary
Constructors Constructor Description SmtpAttachment(java.lang.String filename, java.lang.String contentType, SmtpAttachment.StreamProvider streamProvider)Creates a newSmtpAttachementwith the specified parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetContentType()Returns the Content Type.java.lang.StringgetFilename()Returns the file name.java.io.InputStreamopenStream()Opens a newInputStreamon this attachment.
-
-
-
Constructor Detail
-
SmtpAttachment
public SmtpAttachment(java.lang.String filename, java.lang.String contentType, SmtpAttachment.StreamProvider streamProvider)Creates a newSmtpAttachementwith the specified parameters.- Parameters:
filename- The attachment's name.contentType- The Content Type.streamProvider- The stream provider.
-
-
Method Detail
-
getFilename
public java.lang.String getFilename()
Returns the file name.- Returns:
- The file name.
-
getContentType
public java.lang.String getContentType()
Returns the Content Type. Generally, this will look liketext/plain; charset=us-ascii; name=file.txt
.- Returns:
- The Content TYpe.
-
openStream
public java.io.InputStream openStream() throws java.io.IOException, jakarta.mail.MessagingExceptionOpens a newInputStreamon this attachment. This method can only be called once.- Returns:
- A new
InputStream. - Throws:
java.io.IOExceptionjakarta.mail.MessagingException
-
-