All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class MSBMail.MailMsgPart

java.lang.Object
   |
   +----MSBMail.MailMsgPart

public class MailMsgPart
extends Object

This is a part of an e-mail. A message is always made of parts. In the simplest case there is just one part that contains text, however one part can contain a file (binary data), a HTML page or other parts (type multipart).

For example, this is a part that contains text:

textpart=new MainMsgPart();                                  
textpart.setData("This is the text",MimeEncoder.QUOTED);
part.addPart(textpart);

this is a part that contains html data:

htmlpart=new MainMsgPart();                                  
htmlpart.ContentType="Text";
htmlpart.ContentSubType="Html";
htmlpart.setData("<html><body>This is the text</body></html>",MimeEncoder.QUOTED);

this is a part that contains binary data:

byte[] binaryData=new {34,13,10,80};

part=new MainMsgPart();                                  
part.ContentType="Application";
part.ContentSubType="Octet-stream";
part.setBinaryData(binaryData,MimeEncoder.BASE64);


Variable Index

 o boundary
 o ContentSubType
 o ContentType
 o Encoding
 o FileName
 o Name
 o partCounter
 o rawHDR

Constructor Index

 o MailMsgPart()

Method Index

 o addPart(MailMsgPart)
 o getBinaryData()
 o getData()
 o getHeader()
 o getPart(int)
 o setBinaryData(byte[])
 o setCodedData(String)
 o setData(String, int)

Variables

 o ContentType
 public String ContentType
see ContentType of MailMsg
 o ContentSubType
 public String ContentSubType
see ContentSubType of MailMsg
 o Encoding
 public int Encoding
Current encoding of the part. The encoding is specified in the setData() method.
 o Name
 public String Name
Name of the part. Optional.
 o FileName
 public String FileName
File name if the part has "Application" ContentType.
 o rawHDR
 public String rawHDR
header of the part as sent or received.
 
 o partCounter
 public int partCounter
 
number of subparts in the part (if ContentType is "Multipart").
 o boundary
 public String boundary
boundary used to separate subparts. Calculated by the system.

Constructors

 o MailMsgPart
 public MailMsgPart()
Creates a new part.
 

Methods

 o addPart
 public void addPart(MailMsgPart p)
Adds a subpart to the part. The ContentType will then be multipart.
 
 o getBinaryData
 public byte[] getBinaryData()
returns binary content of the file. Call this when you receive a mail coded with BASE64.
 o getData
 public String getData()
returns the non-binary content. Call this when the part is not encoded with BASE64.
 o getHeader
 public String getHeader()
returns the header of the part in rfc822 format.
 o getPart
 public MailMsgPart getPart(int num)
returns a subparft of the part.
 o setBinaryData
 public void setBinaryData(byte b[])
sets the binary content of the part. The part will be encoded with BASE64.
 o setCodedData
 public void setCodedData(String d)
method called by the POP connection to store the received data.
 o setData
 public void setData(String d,
                     int encoding)
sets the content of the part if not binary, you must specify an encoding method:

All Packages  Class Hierarchy  This Package  Previous  Next  Index