You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Goetzmann Bertrand <bg...@sophia.symag.com> on 2005/11/29 12:47:52 UTC
Problem with sendmail action
Hello,
I use the sendmail action in my sitemap.xmap to, of course, send emails
from a form. It works well if all the parameters needed are correct, but
otherwise I can't read the "status" parameter that the action set.
I think it is perhaps a bug because in the concerned source code,
Sendmail.java from org.apache.cocoon.acting package, if the operation
fails (an exception is raized), the act method returns null, and then
you can't read the "status" (with the value server-error or user-error)
parameter nor the "message" parameter, in the sitemap.
Is someone cab confirm this ? Thank.
Bertrand Goetzmann.
Re: Problem with sendmail action
Posted by Philippe Gassmann <ph...@anyware-tech.com>.
Goetzmann Bertrand wrote:
> Hello,
>
> I use the sendmail action in my sitemap.xmap to, of course, send
> emails from a form. It works well if all the parameters needed are
> correct, but otherwise I can't read the "status" parameter that the
> action set.
>
> I think it is perhaps a bug because in the concerned source code,
> Sendmail.java from org.apache.cocoon.acting package, if the operation
> fails (an exception is raized), the act method returns null, and then
> you can't read the "status" (with the value server-error or
> user-error) parameter nor the "message" parameter, in the sitemap.
>
> Is someone cab confirm this ? Thank.
>
>
> Bertrand Goetzmann.
>
After having a look to the source code, yes you're right !
When an exception occurs, the sendmail action returns null to the
sitemap. But, I can see this in the source code :
finally{
ObjectModelHelper.getRequest(objectModel).setAttribute(Sendmail.REQUEST_ATTRIBUTE,status);
}
I guess it is possible to get the status not using what's returned by
the action but using what the action sets in the request with the input
module request:
{request:attributes/org.apache.cocoon.acting.Sendmail/status} for the status
and {request:attributes/org.apache.cocoon.acting.Sendmail/status} for
the message.
This is really a strange behaviour !
--
Philippe GASSMANN