I wrote:
In my mailserver development I get around this by not constructing a
MimeMessage (can't see that I need one), writing the message body
right into a file.

Noel J. Bergman wrote:
... if you or anyone else has some patches,
please feel free to contribute them.

Noel,


Below you can see the little part of my present code that copies in a message.

But this is not a "patch", in that I have not considered how it might fit into James. Many of my ideas come from James. But there are many differences too. For instance, I've decided that I can do what I need without ever constructing a MimeMessage out of a message which comes into my server.

Rich Hammer
Hillsborough, N.C.
mailscreen.net  -- a hope, a dream


public class Message { InternetHeaders headers; MailAddress envelopeFrom; ArrayList envelopeTo; File dataFile; //will hold message data but not headers String sentHereFromHost, sentHereFromIP, uniqueID; long receivedTime; long dataLength = -8, totalSize = -22;

/* A constructor to be used by the SMTP receiver, after envelope information
* has been received, headers have been parsed and updated, and the message
* input stream is positioned to start reading
* the message body.
*/
public Message(String remoteHost, String remoteIP, MailAddress envelopeFrom,
ArrayList envelopeTo, InternetHeaders headers, InputStream dataIn)
throws IOException{
sentHereFromHost = remoteHost;
sentHereFromIP = remoteIP;
this.envelopeFrom = envelopeFrom;
sortByDomain(envelopeTo);
this.envelopeTo = envelopeTo;
this.headers = headers;
setText(dataIn);
}


protected void setText(InputStream dataIn) throws IOException{
uniqueID = getNewUniqueId();
dataFile = new File(messagesDirectory, uniqueID);
OutputStream out = new BufferedOutputStream(new FileOutputStream(dataFile));
byte[] block = new byte[fileTransferBlockSize];
int readCount;
while ((readCount = dataIn.read(block)) > -1) {
out.write(block, 0, readCount);
}
out.close();
dataLength = dataFile.length();
receivedTime = System.currentTimeMillis();
}


...

}//class Message

The above code is copyrighted, by which I mean to copy it is right!



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to