org.apache.cocoon.acting
Class Sendmail
java.lang.Object
org.apache.cocoon.util.AbstractLogEnabled
org.apache.cocoon.acting.AbstractAction
org.apache.cocoon.acting.ServiceableAction
org.apache.cocoon.acting.Sendmail
- All Implemented Interfaces:
- org.apache.cocoon.acting.Action, Configurable, Serviceable, ThreadSafe
- Direct Known Subclasses:
- SendmailAction
- public class Sendmail
- extends org.apache.cocoon.acting.ServiceableAction
- implements ThreadSafe, Configurable
The Sendmail
action class sends email.
Action supports following parameters:
- smtp-host
- The smtp server to send the mail through. If not specified,
default from cocoon.xconf will be used.
- smtp-user
- The smtp user. If smtp-user and smtp-host not specified,
default from cocoon.xconf will be used.
- smtp-password
- The smtp user's password. If smtp-user and smtp-host not
specified, default from cocoon.xconf will be used.
- from
- the email address the mail appears to be from
- to
- the email address(es) the mail it sent to. This can
be multiple addresses separated with commas.
- replyTo
- the email address(es) replies should be sent to. This can
be multiple addresses separated with commas.
- cc
- an email address(es) of someone, who should receive a
carbon copy. This can also be a list of multiple addresses
separated by commas.
- bcc
- an email address(es) of someone, who should receive a black
carbon copy. This can also be a list of multiple addresses
separated by commas.
- subject
- the subject line of the email
- src
- A url specifying the source of the text body of the email
- srcMimeType
- The optional Mime Type of the source of the text body of the email
if you specified src
- body
- the text body of the email, if src is specified, body will be ignored
- charset
- the character set, which should be used the encode the body text.
This parameter is only used, if no attachements are send.
- attachments
- One or more attachments, separated by whitespace, which should be
attached to the email message. If the argument contains a ':', it is
assumed, that the argument describes a
org.apache.excalibur.source.Source
object. Otherwise, it
is assumed, that the argument describes a request parameter of an
uploaded file, which Cocoon has internally turned into a
Part
object.
Minimally, from
, to
, body
parameters
should be specified. Rest of parameters are optional.
The class loads all of these parameters from the sitemap, except the
attachements, which may come from file upload request parameters.
Note it's strongly recommended that the to, cc and bcc addresses be
specified by the sitemap, not the request, to prevent possible abuse of the
SendmailAction as a spam source.
One or two parameters are returned to the sitemap depending on the outcome
of sending the message: status
and message
.
If the email message could be successfully delivered only the parameter
status
with the value success
is returned.
If there was a problem sending the message, status
can have
the value user-error
and the message
parameter is set to an explainatory text. This usually indicates problems with
one or more email addresses. Other problems lead to a value of
server-error
for status
and
message
contains a corresponding message.
- Since:
- 2.1
- Version:
- $Id: Sendmail.html 1304280 2012-03-23 11:18:01Z ilgrosso $
Fields inherited from class org.apache.cocoon.acting.ServiceableAction |
manager |
Fields inherited from class org.apache.cocoon.acting.AbstractAction |
EMPTY_MAP |
Fields inherited from interface org.apache.cocoon.acting.Action |
ROLE |
Methods inherited from class org.apache.cocoon.acting.ServiceableAction |
service |
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled |
getLogger, setLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
REQUEST_ATTRIBUTE
public static final String REQUEST_ATTRIBUTE
- Request-Attribute that holds status data
- See Also:
- Constant Field Values
Sendmail
public Sendmail()
configure
public void configure(Configuration conf)
throws ConfigurationException
- Specified by:
configure
in interface Configurable
- Throws:
ConfigurationException
act
public Map act(org.apache.cocoon.environment.Redirector redirector,
org.apache.cocoon.environment.SourceResolver resolver,
Map objectModel,
String source,
Parameters parameters)
throws Exception
- Specified by:
act
in interface org.apache.cocoon.acting.Action
- Throws:
Exception
Copyright © 1999-2008 The Apache Software Foundation. All Rights Reserved.