in src/components/src/main/java/org/apache/jmeter/reporters/MailerModel.java [197:248]
public synchronized void add(SampleResult sample, boolean sendMails) {
// -1 is the code for a failed sample.
//
if (!sample.isSuccessful()) {
failureCount++;
successCount = 0;
} else {
successCount++;
}
if (sendMails && (failureCount > getFailureLimit()) && !siteDown && !failureMsgSent) {
// Send the mail ...
List<String> addressList = getAddressList();
if (!addressList.isEmpty()) {
try {
sendMail(getFromAddress(), addressList, getFailureSubject(), "URL Failed: "
+ sample.getSampleLabel(), getSmtpHost(),
getSmtpPort(), getLogin(), getPassword(),
getMailAuthType(), false);
} catch (Exception e) {
log.error("Problem sending mail: "+e);
}
siteDown = true;
failureMsgSent = true;
successCount = 0;
successMsgSent = false;
}
}
if (sendMails && siteDown && (sample.getTime() != -1) && !successMsgSent && successCount > getSuccessLimit()) {
List<String> addressList = getAddressList();
try {
sendMail(getFromAddress(), addressList, getSuccessSubject(), "URL Restarted: "
+ sample.getSampleLabel(), getSmtpHost(),
getSmtpPort(), getLogin(), getPassword(),
getMailAuthType(), false);
} catch (Exception e) {
log.error("Problem sending mail", e);
}
siteDown = false;
successMsgSent = true;
failureCount = 0;
failureMsgSent = false;
}
if (successMsgSent && failureMsgSent) {
clear();
}
notifyChangeListeners();
}