////////////////////////////////////////////////////////////////////////// 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. //////////////////////////////////////////////////////////////////////////
| 662 | // |
| 663 | /////////////////////////////////////////////////////////////////////////////// |
| 664 | bool 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 | |
| 708 | bool cTWCmdLineUtil::SendEmailTestMessage(const TSTRING& mAddress, const cTWModeCommon* modeCommon) |
nothing calls this directly
no test coverage detected