alanrenouf / vCheck-vSphere

vCheck Daily Report for vSphere
MIT License
735 stars 325 forks source link

vCheck is not sending email #436

Closed santoshchowdary07 closed 8 years ago

santoshchowdary07 commented 8 years ago

Hi,

I ran the vCheck.ps1 and it did not send me any email with the report. Below is the output screenshot.

screen shot 2016-01-23 at 3 49 45 pm

Sneddo commented 8 years ago

Can you post your config file? It looks like it's not even trying to send the email, either because the report is empty and $EmailReportEvenIfEmpty is $false, or because $SendEmail is set to $false

santoshchowdary07 commented 8 years ago

Below is the configuration for my vcheck. I have deleted email addresses and smtp server from below report for security reasons.

  # You can change the following defaults by altering the below settings:
  #

  # Set the following to true to enable the setup wizard for first time run
  $SetupWizard = $False

  # Start of Settings
  # Report header
  $reportHeader = KWPVVC002 vCheck Report"
  # Would you like the report displayed in the local browser once completed ?
  $DisplaytoScreen = false
  # Display the report even if it is empty?
  $DisplayReportEvenIfEmpty = true
  # Use the following item to define if an email report should be sent once completed
  $SendEmail = true
  # Please Specify the SMTP server address (and optional port) [servername(:port)]
  $SMTPSRV = "xyz"
  # Would you like to use SSL to send email?
  $EmailSSL = $false
  # Please specify the email address who will send the vCheck report
  $EmailFrom = "xyz"
  # Please specify the email address(es) who will receive the vCheck report (separate multiple addresses with comma)
  $EmailTo = "xyz"
  # Please specify the email address(es) who will be CCd to receive the vCheck report (separate multiple addresses with comma)
  $EmailCc = ""
  # Please specify an email subject
  $EmailSubject = "ETCKWPVVC002 vCheck Report"
  # Send the report by e-mail even if it is empty?
  $EmailReportEvenIfEmpty = $true
  # If you would prefer the HTML file as an attachment then enable the following:
  $SendAttachment = $false
  # Set the style template to use.
  $Style = "VMware"
  # Do you want to include plugin details in the report?
  $reportOnPlugins = $true
  # List Enabled plugins first in Plugin Report?
  $ListEnabledPluginsFirst = $true
  # Set the following setting to $true to see how long each Plugin takes to run as part of the report
  $TimeToRun = $true
  # Report on plugins that take longer than the following amount of seconds
  $PluginSeconds = 30
  # End of Settings

  # End of Global Variables
Sneddo commented 8 years ago

From looking at the screenshot, this must be evaluating to false if ($SendEmail -and (!($emptyReport -and !$EmailReportEvenIfEmpty))) {

Is the report generated in your temp directory? And what version of vCheck are you running?

santoshchowdary07 commented 8 years ago

I don't see the report generated in my temp directory. I am using the latest version downloaded from below URL.

http://www.virtu-al.net/vcheck-pluginsheaders/vcheck/

santoshchowdary07 commented 8 years ago

Hi Sneddo,

Is there any solution for my issue?

Sneddo commented 8 years ago

I assume you mean the latest from the master branch? https://github.com/alanrenouf/vCheck-vSphere/archive/master.zip

I just noticed you seem to be hitting issue #217 as well, which may explain it...

AlphaCasper2001 commented 8 years ago

There is a wrong parameter in the vCheck.ps1 file.

Beginning on line 809 (I'm using Notepad++ to edit) change the variable $server to $smtpsrv

$smtpClient.Host = ($SMTPSRV -Split ":")[0] if (($server -split ":")[1]) { $smtpClient.Port = (_$server _-split ":")[1] }

TO

$smtpClient.Host = ($SMTPSRV -Split ":")[0] if (($SMTPSRV -split ":")[1]) { $smtpClient.Port = ($SMTPSRV -split ":")[1] }

Sneddo commented 8 years ago

Good catch, fixed in the dev branch

mw403git commented 8 years ago

I hit this problem today as well, hopefully it will be fixed soon.

Michael

buckmaster60 commented 8 years ago

What is the format when your email server requires a password? I saw in a post username/password but I'm not receiving emails and I applied the change above. $smtpClient.Host = ($SMTPSRV -Split ":")[0] if (($SMTPSRV -split ":")[1]) { $smtpClient.Port = ($SMTPSRV -split ":")[1] } Tom

buckmaster60 commented 8 years ago

email working. username@domain.com

is the change above updated as I just downloaded the zip and i had to make the smtpsrv change? t

bareddy8 commented 8 years ago

$SMTPSRV did the trick for me, Thanks a ton ..!!

AB