All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----MSBMail.MailMsgPart
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);
public String ContentType
see ContentType of MailMsg
public String ContentSubType
see ContentSubType of MailMsg
public int Encoding
Current encoding of the part. The encoding is specified in the setData() method.
public String Name
Name of the part. Optional.
public String FileName
File name if the part has "Application" ContentType.
public String rawHDR
header of the part as sent or received.
public int partCounter
number of subparts in the part (if ContentType is "Multipart").
public String boundary
boundary used to separate subparts. Calculated by the system.
public MailMsgPart()
Creates a new part.
public void addPart(MailMsgPart p)
Adds a subpart to the part. The ContentType will then be multipart.
public byte[] getBinaryData()
returns binary content of the file. Call this when you receive a mail coded with BASE64.
public String getData()
returns the non-binary content. Call this when the part is not encoded with BASE64.
public String getHeader()
returns the header of the part in rfc822 format.
public MailMsgPart getPart(int num)
returns a subparft of the part.
public void setBinaryData(byte b[])
sets the binary content of the part. The part will be encoded with BASE64.
public void setCodedData(String d)
method called by the POP connection to store the received data.
public void setData(String d, int encoding)
sets the content of the part if not binary, you must specify an encoding method:
MimeEncoder.NO_ENCODE.
MimeEncoder.QUOTED. It is recomemded to use at least this one. It supports caracters like á, ö ...
MimeEncoder.BASE64. Supports binary data.
All Packages Class Hierarchy This Package Previous Next Index