I’ve got a similar problem retriving file attachs.
I solve it using a java program. You must point
the inbound mail to this program.
I’m not a java programer but it works !!
Feel free to change it for your convenience:
good luck,
Sebasti�Miranda
Barcelona, Spain
/******************************************************
********************************************************/
String subject = null;
String from = null;
String contenttype = null;
String protocol = null;
String filename = null;
String sentdate = null;
String recvdate = null;
boolean mail = false;
String destinatario = null;
String body = null;
IData salida = IDataFactory.create();
String contenido = null ;
ByteArrayInputStream is = null;
byte contenidoBytes = null;
IDataHashCursor idhc = pipeline.getHashCursor();
if (idhc.first(“transport”)) {
IData transport = (IData)idhc.getValue();
idhc.destroy();
idhc = transport.getHashCursor();
if ( idhc.first("protocol" )) {
protocol = (String)idhc.getValue();
if ( protocol.equals("email") ) {
if ( idhc.first("email")) {
IData email = (IData)idhc.getValue();
mail = true;
idhc.destroy();
idhc = email.getHashCursor();
if ( idhc.first("subject") ) {
subject = (String)idhc.getValue();
}
if ( idhc.first("content") ) {
is = (ByteArrayInputStream) idhc.getValue();
}
if ( idhc.first("filename") ) {
filename = (String)idhc.getValue();
}
if ( idhc.first("from") ) {
from = (String[])idhc.getValue();
}
if ( idhc.first("sentdate") ) {
sentdate = (String)idhc.getValue();
}
idhc.destroy();
}
}
}
}
/******************************************************
- EXTRAIGO el contenido de los ficheros
******************************************************/
try{
ByteArrayOutputStream os = new ByteArrayOutputStream();
int lenZ = 0;
byte tmpBt = new byte[2048];
while (lenZ != -1)
{
try{
lenZ = is.read(tmpBt);
}
catch(EOFException e){
lenZ = -1;
}
if (lenZ > 0) os.write(tmpBt, 0, lenZ);
}
contenido = os.toString();
contenidoBytes = os.toByteArray();
is.close();
os.close();
}
// PROBLEMAS ???
catch (IOException e){
sendMail(“SMiranda@pastasgallo.es”, “EnviosEDI@pastasgallo.es”, subject,
" Problemas con los envios de Dhul: " + e );
}
/******************************************************
if (mail){
destinatario = “SMiranda@pastasgallo.es”;
subject = “Pruebas Tratamiento Mails: " + subject;
body = " TEST: \n Enviado el: " + sentdate
+”\n De: " + from[0]
+“\n Archivo: " + filename
+”\n Contenido: \n"+ contenido;
sendMail(destinatario, “EnviosEDI@pastasgallo.es”, subject, body);
}
******************************************************/
// Data output
IDataCursor pipelineCursor_2 = pipeline.getCursor();
IDataUtil.put( pipelineCursor_2, “Contenido”, contenido );
IDataUtil.put( pipelineCursor_2, “contentBytes”, contenidoBytes );
IDataUtil.put( pipelineCursor_2, “filename”, filename );
IDataUtil.put( pipelineCursor_2, “from”, from[0] );
IDataUtil.put( pipelineCursor_2, “subject”, subject );
pipelineCursor_2.destroy();