#1063 closed defect (worksforme)

smartd_mailer.ps1 does not work

Reported by: Mateus Henrique Owned by:
Priority: minor Milestone:
Component: smartd Version: 6.6
Keywords: smartd.conf windows Cc:

Description

Hi all.

Firstly, thx for this great software contribuition.
I'm having problems with experimental email sender feature of Windows version (PowerShell?). How this really works?

Well....We have bin folder structure script/conf files:

smartd.conf

smartd_mailer.conf.sample.ps1
smartd_mailer.ps1
smartd_warning.cmd


According wiki (https://www.smartmontools.org/browser/trunk/smartmontools/smartd.conf.5.in) and my understanding, first we need to create/manage directives to determine actions.
Ex: Generate Logs by bad blocks, bad life hard disk and send mail...

I'm using Windows 10 release 1803 x64 and version 6.6.207-11-05 r4594 (sf-6.6.1)
My problem, is now...

  1. What hierarchy of setting up files? Who file come's first, who depend who, who call who? Basically: smartd.conf => smartd_warning.cmd => defines what mail sender => smartd_mailer.ps1 => read SMTP data => smartd_mailer.conf.sample.ps1 Is that correct?


  1. smartd.conf call smartd_warning.cmd with -M exec? But, in the wiki says:

If the file EXEDIR/smartd_mailer.conf.ps1 is present and '-M exec' is not specified, the script smartd_mailer.ps1 is used instead.
This script uses the Send-MailMessage? cmdlet to send mail. See EXEDIR/smartd_mailer.conf.sample.ps1 for info about the format of the configuration file.

  1. smartd_warning.cmd verify what's and call default mailer.

if smartd_mailer.ps1 exists, AND -M exec directive not specified, automatically will use PowerShell? method, right?


  1. About script smartd_warning.cmd, When I run, he everytime say: "smartd_warning.cmd: SMARTD_ADDRESS or SMARTD_MAILER must be set"

How I can set these variables?
I just tried uncomenting echo, and increment values to specified vars.


  1. How I can test if a mail is working correctly? I trying but no success. Using -M test not working.

Thx.

Change History (3)

comment:1 in reply to:  description Changed 13 months ago by Christian Franke

Component: allsmartd
Keywords: smartd.conf windows added; help mail powershell not work removed
Summary: Help about basic to work.smartd_mailer.ps1 does not work

This is a bug tracker, not a support forum. For future support questions, please use the smartmontools-support mailing list instead.

comment:2 in reply to:  description Changed 13 months ago by Christian Franke

Replying to Mateus Henrique:

  1. What hierarchy of setting up files? Who file come's first, who depend who, who call who?

If smartd.conf specifies -m ADDRESS, then smartd.exe always runs smartd_warning.cmd. Parameters are passed via environment (SMARTD_ADDRESS=ADDRESS, see man page for others). If -M exec PATH is not specified (SMARTD_MAILER unset) and smartd_mailer.conf.ps1 is present, then smartd_warning.cmd runs smartd_mailer.ps1.

  1. smartd.conf call smartd_warning.cmd with -M exec? ...

Never(!) use smartd_warning.cmd or smartd_mailer.ps1 as -M exec parameter. If -M exec PATH is specified, smartd.exe sets SMARTD_MAILER=PATH and then smartd_warning.cmd runs the executable at PATH.

  1. smartd_warning.cmd verify what's and call default mailer.

if smartd_mailer.ps1 exists, AND -M exec directive not specified, automatically will use PowerShell method, right?

No. If smartd_mailer.conf.ps1 is not present, smartd_warning.cmd will use blat.exe to send mail.

  1. About script smartd_warning.cmd, When I run, he everytime say: "smartd_warning.cmd: SMARTD_ADDRESS or SMARTD_MAILER must be set"

How I can set these variables?

C:\Program Files\smartmontools\bin>smartd_warning.cmd
smartd_warning.cmd: SMARTD_ADDRESS or SMARTD_MAILER must be set

C:\Program Files\smartmontools\bin>set SMARTD_ADDRESS=some.name@some.where

C:\Program Files\smartmontools\bin>smartd_warning.cmd
[No output -> Mail sent to some.name@some.where]

C:\Program Files\smartmontools\bin>smartd_warning.cmd --dryrun
... [Long debug output, no mail sent]
  1. How I can test if a mail is working correctly? I trying but no success. Using -M test not working.

If -M test does not work, please run smartd -q onecheck in an admin console and provide its output and the smartd.conf used. Use an attachment or wiki markup for preformatted text (do not use screenshots).

comment:3 Changed 12 months ago by Christian Franke

Milestone: undecided
Resolution: worksforme
Status: newclosed

The script smartd_mailer.ps1 works as expected. No feedback from reporter.

Note: See TracTickets for help on using tickets.