@Singleton @Configurable public class SendMail extends AbstractHealthAction
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 and Description |
---|
SendMail() |
Modifier and Type | Method and Description |
---|---|
void |
addTo(java.lang.String to)
Add a "TO:" address; a mail recipient
|
HealthActionResult |
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
|
add, addListener, doAction, getPredicates, start, stop, toString
@PostConstruct public void init()
init
in class AbstractHealthAction
@Configurable public void addTo(java.lang.String to) throws AddressException
AddressException
- for an invalid email address@Configurable public void setFrom(java.lang.String from) throws AddressException
AddressException
- for an invalid email address@Configurable public void setMail(Session session)
public HealthActionResult doActionImpl(HealthEvent healthEvent) throws java.lang.Exception
doActionImpl
in class AbstractHealthAction
java.lang.Exception