| org.apache.cocoon.mail.MailMessageSender
MailMessageSender | public class MailMessageSender extends AbstractLogEnabled implements MailSender,Configurable,Serviceable,Initializable,Component(Code) | | A helper class used by the
org.apache.cocoon.acting.Sendmail and the sendmail.xsl logicsheet for sending an email message.
Configuration
smtp-host | SMTP server to use sending mail. | opt | String | localhost |
smtp-user | User name for authentication | opt | String |
smtp-password | Password for authentication | opt | String |
since: 2.1 author: Frank Ridderbusch author: Christian Haul version: $Id: MailMessageSender.java 588324 2007-10-25 19:54:27Z vgritsenko $ |
Method Summary | |
public void | addAttachment(Object attachment) Add an attachement to the message to be send. | public void | addAttachment(Object attachment, String type, String name) Add an attachement to the message to be send. | public void | addAttachmentURL(String url) Add an attachement to the message to be send. | public void | addAttachmentURL(String url, String type, String name) Add an attachement to the message to be send. | public void | configure(Configuration config) | public Exception | getException() Accesses any Exception caught by
MailMessageSender.sendIt(org.apache.cocoon.environment.SourceResolver) . | public void | initialize() | public void | send() Assemble the message from the defined fields and send it. | public void | send(org.apache.cocoon.environment.SourceResolver resolver) Assemble the message from the defined fields and send it. | public boolean | sendIt() Invokes the
MailMessageSender.send() method but catches any exception thrown. | public boolean | sendIt(org.apache.cocoon.environment.SourceResolver resolver) Invokes the
MailMessageSender.send(org.apache.cocoon.environment.SourceResolver) method but catches any exception thrown. | public void | service(ServiceManager manager) | public void | setBcc(String bcc) Sets the address(es), which should receive a black carbon copy of
the message. | public void | setBody(String body) Sets the body text of the email message. | public void | setBody(Object body) Sets the body content of the email message. | public void | setBody(Object body, String type) Sets the body content of the email message. | public void | setBodyFromSrc(String src) Sets the body source URL of the email message. | public void | setBodyFromSrcMimeType(String srcMimeType) Sets the optional body source Mime Type of the email message. | public void | setBodyURL(String url) Sets the body content of the email message. | public void | setBodyURL(String url, String type) Sets the body content of the email message. | public void | setCc(String cc) Sets the address(es), which should receive a carbon copy of the
message. | public void | setCharset(String charset) Sets the character set for encoding the message. | public void | setFrom(String from) Set the from address of the message. | public void | setReplyTo(String replyTo) Sets the reply-to address(es) for the message. | public void | setSmtpHost(String hostname) | public void | setSmtpHost(String hostname, String username, String password) | public void | setSubject(String subject) Sets the subject line of the message. | public void | setTo(String to) Sets the destination address(es) for the message. |
MailMessageSender | public MailMessageSender()(Code) | | |
MailMessageSender | public MailMessageSender(String smtpHost)(Code) | | Creates a new instance of MailMessageSender.
Keep constructor for backwards compatibility.
Parameters: smtpHost - The host name or ip-address of a host to acceptthe email for delivery.MailSender |
addAttachmentURL | public void addAttachmentURL(String url)(Code) | | Add an attachement to the message to be send.
Parameters: url - URL to attach to the message See Also: org.apache.excalibur.source.Source |
addAttachmentURL | public void addAttachmentURL(String url, String type, String name)(Code) | | Add an attachement to the message to be send.
Parameters: url - URL to attach to the message Parameters: type - mime type (optional) Parameters: name - attachment name (optional) See Also: org.apache.excalibur.source.Source |
configure | public void configure(Configuration config) throws ConfigurationException(Code) | | |
initialize | public void initialize()(Code) | | |
send | public void send() throws AddressException, MessagingException(Code) | | Assemble the message from the defined fields and send it.
throws: AddressException - when problems with email addresses are found throws: MessagingException - when message could not be send. |
sendIt | public boolean sendIt()(Code) | | Invokes the
MailMessageSender.send() method but catches any exception thrown. This
method is intended to be used from the sendmail logicsheet.
true when successful |
service | public void service(ServiceManager manager)(Code) | | |
setBcc | public void setBcc(String bcc)(Code) | | Sets the address(es), which should receive a black carbon copy of
the message. The address is in the format, that
javax.mail.internet.InternetAddress.parse(String) can handle
(one or more email addresses separated by a commas).
Parameters: bcc - the address(es), which should receive a black carbon copy. See Also: javax.mail.internet.InternetAddress.parse(String) |
setBody | public void setBody(String body)(Code) | | Sets the body text of the email message.
If both a text body and a body read from a source are set,
only the latter will be used.
Parameters: body - The body text of the email messageMailMessageSender.setBody(Object) |
setBodyFromSrc | public void setBodyFromSrc(String src)(Code) | | Sets the body source URL of the email message.
If both a text body and a body read from a source are set,
only the latter will be used.
Parameters: src - The body source URL of the email messageMailMessageSender.setBodyURL(String) |
setBodyURL | public void setBodyURL(String url)(Code) | | Sets the body content of the email message.
Parameters: url - URL to use as message body See Also: org.apache.excalibur.source.Source |
setBodyURL | public void setBodyURL(String url, String type)(Code) | | Sets the body content of the email message.
Parameters: url - URL to use as message body Parameters: type - mime type (optional) See Also: org.apache.excalibur.source.Source |
setCc | public void setCc(String cc)(Code) | | Sets the address(es), which should receive a carbon copy of the
message. The address is in the format, that
javax.mail.internet.InternetAddress.parse(String) can handle
(one or more email addresses separated by a commas).
Parameters: cc - the address(es), which should receive a carbon copy. See Also: javax.mail.internet.InternetAddress.parse(String) |
setCharset | public void setCharset(String charset)(Code) | | Sets the character set for encoding the message. This has no effect,
if any attachments are send in the message.
Parameters: charset - the character set to be used for enbcoding the message |
setFrom | public void setFrom(String from)(Code) | | Set the from address of the message.
Parameters: from - The address the message appears to be from. |
setReplyTo | public void setReplyTo(String replyTo)(Code) | | Sets the reply-to address(es) for the message. The address
is in the format, that
javax.mail.internet.InternetAddress.parse(String) can handle
(one or more email addresses separated by a commas).
Parameters: replyTo - the address(es) that replies should be sent to See Also: javax.mail.internet.InternetAddress.parse(String) |
setSubject | public void setSubject(String subject)(Code) | | Sets the subject line of the message.
Parameters: subject - the subject line of the message |
setTo | public void setTo(String to)(Code) | | Sets the destination address(es) for the message. The address
is in the format, that
javax.mail.internet.InternetAddress.parse(String) can handle
(one or more email addresses separated by a commas).
Parameters: to - the destination address(es) See Also: javax.mail.internet.InternetAddress.parse(String) |
|
|