Hi Christian,

Thanks for your answer.

The lack of the Body-part wasn't the real problem. The problem ist, that it
throws an exception as soon as i have an attachment and a html-mail. As far
as I know the body-part is only used, when theres no src etc.

Regards,
Nils

> -----Urspr�ngliche Nachricht-----
> Von: Christian Haul [mailto:[EMAIL PROTECTED] 
> Gesendet: Freitag, 7. Mai 2004 09:11
> An: [EMAIL PROTECTED]
> Betreff: Re: Sendmail Action HTML-Mail & Attachment
> 
> 
> Joerg Heinicke wrote:
> > 
> > 
> > On 04.05.2004 13:07, Nils K�ster wrote:
> > 
> >> I'm trying to send mail via the sendmail action with html-body and 
> >> pdf-attachment, my sitemap looks like this:
> >>
> >>   <map:act type="sendmail">
> >>     <map:parameter name="smtphost" value="some.smtp.de"/>
> >>     <map:parameter name="from" value="[EMAIL PROTECTED]"/>
> >>     <map:parameter name="to" value="[EMAIL PROTECTED]"/>
> >>     <map:parameter name="subject" value="{request-param:subject}"/>
> >>     <!--map:parameter name="body" 
> value="{request-param:message}"/-->
> >>     <map:parameter name="src" value="context://mailer/test.html"/>
> >>     <map:parameter name="srcMimeType" value="text/html"/>
> >>     <map:parameter name="cc" value=""/>
> >>     <map:parameter name="bcc" value="[EMAIL PROTECTED]"/>
> >>     <map:parameter name="attachments"
> >> value="{request-param:attachment}"/>
> >>     <map:parameter name="charset" value="ISO-8859-1"/>
> >>   </map:act>
> >>
> >> In request-param:attachment i have something like: 
> >> context:/nkpm/resources/documents/some.pdf
> >>
> >> But it doesn't send the mail when I have both in it: 
> attachment and 
> >> html-src. With one of them it works.
> >>
> >> Does anybody have a clue?
> > 
> > 
> >> In the error.log I get:
> >> -----------------------------------------------
> >> ERROR   (2004-05-02) 22:25.32:156   [sitemap.action.sendmail] 
> >> (/mailer/mail)
> >> http8080-Processor25/Sendmail: SendmailAction: An exception was 
> >> thrown
> >> while
> >> sending email. java.lang.NullPointerException
> >>     at
> >> 
> org.apache.cocoon.mail.MailMessageSender.send(MailMessageSende
> r.java:323)
> >>     at org.apache.cocoon.acting.Sendmail.act(Sendmail.java:253)
> > 
> > 
> >  From the code the NPE is obvious:
> > 
> > 306    BodyPart bodypart = null;
> > 307
> > 308    if (this.src != null) {
> > 309        DataSource ds = null;
> > 310
> > 311        Source source = resolver.resolveURI(this.src);
> > 312        sourcesList.add(source);
> > 313        if (source.exists()) {
> > 314            ds =
> > 315                new SourceDataSource(
> > 316                    source,
> > 317                    (this.srcMimeType == null
> > 318                        ? source.getMimeType()
> > 319                        : this.srcMimeType),
> > 320                    
> this.src.substring(this.src.lastIndexOf('/') + 1));
> > 321        }
> > 322
> > 323        bodypart.setDataHandler(new DataHandler(ds));
> > 324        bodypart.setFileName(ds.getName());
> > 325
> > 326        multipart.addBodyPart(bodypart);
> > 
> > bodypart was never set/is still null in line 323.
> > 
> > Unfortunately I don't know how to fix it and I don't have 
> the time to
> > dive in at the moment. Christian wrote the code and could 
> probably fix 
> > it in the shortest time as he knows what should happen. 
> Unfortunately he 
> > made himself very rare on the lists in the last weeks, so I 
> guess he has 
> > not much time ATM neither.
> 
> Hi Nils, Joerg,
> 
> sorry that I can't look into this ATM but I believe the 
> original idea was that every mail should contain a plain text 
> body, not just attachments. However, we could for example 
> provide a default text like "please see attachment" or the 
> like but I feel like it would make more sense to do this 
> application specific.
> 
> So, the simplest solution for Nils would be to add such a 
> body text and add the pdf as attachment.
> 
> I need to dig up the specs to see if it is allowed to have no 
> bodypart. Will try to look into this over the weekend.
> 
> Cheers,
>       Chris.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to