• Post Reply Bookmark Topic Watch Topic
  • New Topic

Javamail - URLDataSource error  RSS feed

Ewert Cloete
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get the following error when trying to attach a image file to a message using the URLDataSource.
The Error:
at javax.mail.internet.ContentType.<init>(ContentType.java:71)
at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1051)
Here is a snippet of the code:
Multipart multipart = new MimeMultipart("related");
multipart.addBodyPart( bodyPart );
bodyPart = new MimeBodyPart();
URL url = new URL("");
URLDataSource uds = new URLDataSource( url );
//DataSource ds = new URLDataSource( url );
bodyPart.setDataHandler(new DataHandler( url ));
What am i doing wrong? I can attach a file using a FileDataSource but the problem is i need to get the image from a web server inside our firewall (newly generated image every 30 mins with same name) - then send the mail outside our firewall to users who cannot access our network....so therefore i need to attach the image the the mail but with have had no luck.
Could anyone please tell me how to do this?
Thanks in advance
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!