com.caucho.health.action
Class SendMail

java.lang.Object
  extended by com.caucho.health.action.AbstractHealthAction
      extended by com.caucho.health.action.SendMail
All Implemented Interfaces:
HealthAction

@Singleton
@Configurable
public class SendMail
extends AbstractHealthAction

Health action to send an email containing the results of the health check.

The SMTP server should be configured using a <mail> resource, as demonstrated in the following example. See Resin documentation on <mail> for additional configuration.

<health:HttpStatusHealthCheck ee:Named="httpStatusCheck">
   <url>http://localhost:8080/test-ping.jsp</url>
 </health:HttpStatusHealthCheck>
 
 <mail name="healthMailer">
   <from>resin@yourdomain.com</from>
   <smtp-host>localhost</smtp-host>
   <smtp-port>25</smtp-port>
 </mail>
 
 <health:SendMail mail="${healthMailer}">
   <to>admin@yourdomain.com</to>
   <to>another_admin@yourdomain.com</to>
   <health:IfHealthCritical healthCheck="${httpStatusCheck}"/>
   <health:IfRechecked/>
 </health:SendMail>
 


Constructor Summary
SendMail()
           
 
Method Summary
 void addTo(java.lang.String to)
          Add a "TO:" address; a mail recipient
 void doActionImpl(HealthEvent healthEvent)
           
 void init()
           
 void setFrom(java.lang.String from)
          Set the "FROM:" address, defaults to "resin@localhost"
 void setMail(Session session)
          Set the javax.mail.Session to send; configure using a <mail> resource
 
Methods inherited from class com.caucho.health.action.AbstractHealthAction
add, addListener, doAction, getPredicates, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SendMail

public SendMail()
Method Detail

init

@PostConstruct
public void init()
Overrides:
init in class AbstractHealthAction

addTo

@Configurable
public void addTo(java.lang.String to)
           throws AddressException
Add a "TO:" address; a mail recipient

Throws:
AddressException - for an invalid email address

setFrom

@Configurable
public void setFrom(java.lang.String from)
             throws AddressException
Set the "FROM:" address, defaults to "resin@localhost"

Throws:
AddressException - for an invalid email address

setMail

@Configurable
public void setMail(Session session)
Set the javax.mail.Session to send; configure using a <mail> resource


doActionImpl

public void doActionImpl(HealthEvent healthEvent)
Specified by:
doActionImpl in class AbstractHealthAction