MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / EmailReport

Method EmailReport

src/tripwire/twcmdlineutil.cpp:664–705  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////////// EmailReport - returns false if any send operation failed, true if they all succeeded. returns false if no recipients were specified anywhere in the policy file. //////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

662//
663///////////////////////////////////////////////////////////////////////////////
664bool cTWCmdLineUtil::EmailReport(const cFCOReportHeader& header,
665 const cFCOReport& report,
666 const cTWModeCommon* modeCommon)
667{
668 // print message that says that we're emailing
669 iUserNotify::GetInstance()->Notify(
670 iUserNotify::V_NORMAL, _T("%s\n"), TSS_GetString(cTripwire, tripwire::STR_EMAIL_BEGIN).c_str());
671
672 bool emailSent = false;
673 bool ret = true;
674
675 // Get the list of recipients
676 std::vector<TSTRING> vstrRecipients;
677
678 GetEmailRecipients(vstrRecipients, report, modeCommon);
679 emailSent |= (vstrRecipients.size() != 0);
680
681 if (vstrRecipients.size() != 0)
682 ret = DoEmailReports(vstrRecipients, header, report, modeCommon, false);
683
684 if (ret)
685 { // if not, probably catostrophic
686
687 vstrRecipients.clear();
688 GetGlobalEmailRecipients(vstrRecipients, report, modeCommon);
689 emailSent |= (vstrRecipients.size() != 0);
690
691 if (vstrRecipients.size() != 0)
692 ret = DoEmailReports(vstrRecipients, header, report, modeCommon, true);
693 }
694
695
696 if (!emailSent)
697 {
698
699 // Send a message to the user, alerting them that no email has been sent.
700 iUserNotify::GetInstance()->Notify(
701 iUserNotify::V_NORMAL, _T("%s\n"), TSS_GetString(cTripwire, tripwire::STR_NO_EMAIL_RECIPIENTS).c_str());
702 }
703
704 return ret;
705}
706
707
708bool cTWCmdLineUtil::SendEmailTestMessage(const TSTRING& mAddress, const cTWModeCommon* modeCommon)

Callers

nothing calls this directly

Calls 6

GetEmailRecipientsFunction · 0.85
DoEmailReportsFunction · 0.85
GetGlobalEmailRecipientsFunction · 0.85
NotifyMethod · 0.80
c_strMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected