$さん
いつも回答ありがとうございます。
以下抜粋ですがソースは以下になります。
ファイルを読み込んだあと、bodyに流し込んで
送信してみました。
結果は、分割されたメールは結合されましたが、添付ファイルができませんでした。
やはりライブラリでは限界があるみたいです。
しゃべるSMTPクライアントとはHELOとかそういうのですかね。
調べてみたいと思います。
byte[] array = new byte[maximumSize];
bis = new BufferedInputStream(new FileInputStream(f), 512);
int readable = bis.read(array);
int index = 1;
String subject = msg.getSubject();
String references = null;
while(readable > 0) {
String messageIdTmp =
MessageFormat.format(MESSAGE_ID_PATTERN, new Object[] {"" + index, messageId });
msg.setHeader("Message-ID", messageIdTmp);
if (references != null) {
msg.setHeader("References", references);
}
references = messageIdTmp;
String subjectTmp =
MessageFormat.format(SUBJECT_PATTERN, new Object[] { subject,"" + index, "" + partSize });
msg.setSubject(subjectTmp);
String body = new String(array, 0, readable);
msg.setText(body);
String contentType =
MessageFormat.format(CONTENT_TYPE_PATTERN, new Object[] {"" + index, "" + partSize,messageId });
msg.setHeader("Content-Type", contentType);
Transport.send(mimeMessage);
readable = bis.read(array);
index++;
}
}
private final static String CONTENT_TYPE_PATTERN = "message/partial; number={0}; total={1}; id=\"<{2}>\"";
private final static String MESSAGE_ID_PATTERN = "<{0}.{1}>";
private final static String SUBJECT_PATTERN = "{0}[{1}/{2}]";