Paul Pattison wrote: >Thanks for your response Vadim. I've been looking at the util logicsheet >and trying to figure this out, but I'm not having much luck. My page is >seems to be just hanging. I'm not sure if it's because of the 'resolver' >line of code or where I create my URLDataSource in the code. All the >examples I could find re sending emails with attachments said to use >FileDataSource if the attachment was a file and URLDataSource if it's a URL. >I couldn't find any examples using URLDataSource, but that's what I think I >should be using. Does anyone have experience with this JavaMail stuff? >Which of the DataSource objects should I be using? FileDataSource or >URLDataSource? > >Is my code to resolve the uri correct? > >Thanks, > >Paul > > >Here is a snippet from the sendmail logicsheet: > >String _sendmail_strSubAttachement; >BodyPart _sendmail_att_part; >DataSource _sendmail_data_source; > >try { > org.apache.excalibur.source.Source input_source = >resolver.resolve("cocoon:/newsletter.pdf"); >
Are you on 2.1? I was referring to 203. In 2.1, you should use resolveURI() method. > _sendmail_data_source = new URLDataSource(new >java.net.URL(input_source.getSystemId())); > This should fail with malformed URL exception: unknown protocol cocoon. Vadim > _sendmail_att_part = new MimeBodyPart(); > _sendmail_att_part.setDataHandler(new DataHandler(_sendmail_data_source)); > _sendmail_att_part.setFileName(_sendmail_data_source.getName()); > _sendmail_multipart.addBodyPart(_sendmail_att_part); >} >catch (Exception e) { > throw new RuntimeException(e.getMessage()); > > >Vadim wrote: > > > >>Hi everyone, >> >>I'm working on a web app where I'd like to have a page send an email >>to someone and attach a file to the email. The attachment would >>actually be an html or pdf document generated by Cocoon. >> >>Right now the 'sendmail' logicsheet allows attachments, but the filename >> >> >> > >Can't find this functionality in sendmail.xsl. > > > > >>is an absolute path to the file. I would like to have it so that >>the path I give the attachment is acutally an internal cocoon:// >>path. I've looked at the sendmail.xls logicsheet, but have not been >>able to figure out how I would implement this. Is what I describe >>possible? I am willing to work on it, but I was wondering if anyone >>had any tips or clues about how I would do this and where I should >>start. Any advice is welcome. >> >> >> > >Look into the recently modified util logicsheet to see how resolver is >used. If you use resolver, you can process any kind of URIs, relative >and absolute, and it works with all protocols. > >Vadim > > > > >>Thanks, >> >>Paul >> >> >> >> >} > > > --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>