Cannot send attachment as application/octet-stream
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Bala_Selva
Posted On:   Thursday, March 6, 2003 03:45 PM

Hi, I am trying to send a binary byte[] as attachment. the following code generates the error below. Any help would be appreciated. Thanks. MimeBodyPart mmbp1 = new MimeBodyPart(); mmbp1.setText(body); MimeBodyPart mmbp2 = new MimeBodyPart(); mmbp2.setContent(attachment, "application/octet-stream"); Error:Can't send command to SMTP host; nested exception is: java.io.IOException: Bad file descriptor javax.mail.MessagingException: Can't send command to SMTP host; nested exception is: java.io.IOException: Bad file descriptor at com.sun.mail.smtp.SMTPTransport.sendC   More>>

Hi,


I am trying to send a binary byte[] as attachment.

the following code generates the error below. Any

help would be appreciated.


Thanks.


			

MimeBodyPart mmbp1 = new MimeBodyPart();
mmbp1.setText(body);

MimeBodyPart mmbp2 = new MimeBodyPart();
mmbp2.setContent(attachment, "application/octet-stream");


Error:Can't send command to SMTP host;
nested exception is:
java.io.IOException: Bad file descriptor
javax.mail.MessagingException: Can't send command to SMTP host;
nested exception is:
java.io.IOException: Bad file descriptor
at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:518)
at com.sun.mail.smtp.SMTPTransport.close(SMTPTransport.java:204)
at javax.mail.Transport.send0(Transport.java:183)
at javax.mail.Transport.send(Transport.java:73)
at sendmail.mail(sendmail.java:95)
at es_server.processData(es_server.java:159)
at es_server.main(es_server.java:53)
   <<Less

Re: Cannot send attachment as application/octet-stream

Posted By:   Christopher_Koenigsberg  
Posted On:   Friday, March 7, 2003 06:43 AM

Can't send command to SMTP host;
nested exception is:
java.io.IOException: Bad file descriptor



That sounds to me like a problem with the SMTP/TCP/IP connection to your SMTP server. The socket is accessed via a file descriptor. Does it always do this? Can you send other messages through that same server?


Are you doing a content-transfer-encoding, e.g. base64? Maybe the SMTP server won't accept raw octet streams, so you need to base64 it first.

About | Sitemap | Contact