Class SmtpAttachment

java.lang.Object
ch.astorm.smtp4j.core.SmtpAttachment

public class SmtpAttachment extends Object
Attachment of an SmtpMessage.
  • Constructor Details

    • SmtpAttachment

      public SmtpAttachment(String filename, String contentType, SmtpAttachment.StreamProvider streamProvider)
      Creates a new SmtpAttachement with the specified parameters.
      Parameters:
      filename - The attachment's name.
      contentType - The Content Type.
      streamProvider - The stream provider.
  • Method Details

    • getFilename

      public String getFilename()
      Returns the file name.
      Returns:
      The file name.
    • getContentType

      public String getContentType()
      Returns the Content Type. Generally, this will look like
      text/plain; charset=us-ascii; name=file.txt
      .
      Returns:
      The Content TYpe.
    • openStream

      public InputStream openStream() throws IOException, jakarta.mail.MessagingException
      Opens a new InputStream on this attachment. This method can only be called once.
      Returns:
      A new InputStream.
      Throws:
      IOException
      jakarta.mail.MessagingException