Project

General

Profile

Bug #27496

Fix for alert emails being improperly addressed

Added by John Newby over 1 year ago. Updated over 1 year ago.

Status:
Resolved
Priority:
Important
Assignee:
William Grzybowski
Category:
OS
Target version:
Seen in:
Severity:
New
Reason for Closing:
Reason for Blocked:
Needs QA:
No
Needs Doc:
Yes
Needs Merging:
Yes
Needs Automation:
No
Support Suite Ticket:
n/a
Hardware Configuration:
ChangeLog Required:
No

Description

This issue described at https://forums.freenas.org/index.php?threads/11-1-cron-job-no-longer-emails-result.60175/ but here summarized:

Under 11.0-U4 cron job emails results of script, after 11.1 update no email.
Have swapped back and forth between versions, problem persists.
Letting the cron job run under 11.0-U4 at 12h00 EST and receiving the expected email output, booting into 11.1 and having the same cron job run at 12h30 EST and NOT getting the expected email output, nothing in var/log/messages, but here's var/log/maillog :

Code:

MIME-Version: 1.0
Content-Transfer-Encoding: base64
Subject: Cron <root@freenasmini> PATH="/bin:/s
Dec 28 12:00:04 freenasmini /find_alias_for_smtplib.py50071: sending mail to -FCronDaemon,-odi,-oem,-oiFrom: Cron Daemon <>
To: root
Subject: Cron <root@freenasmini> PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr
Dec 28 12:00:05 freenasmini /find_alias_for_smtplib.py50071: sending mail to : text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Subject: Cron <root@freenasmini> PATH="/bin:/s
Dec 28 12:30:08 freenasmini /find_alias_for_smtplib.py12138: sending mail to -FCronDaemon,-odi,-oem,-oiFrom: Cron Daemon <>
To: root
Subject: Cron <root@freenasmini> PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr
Dec 28 17:30:09 freenasmini /middlewared217: sending mail to : text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Subject: Cron <root@freenasmini> PATH="/bin:/s

The 11.0-U4 lines timed at 12:00:04 and :05 were associated with an email being received, those 11.1 lines timed at 12:30:08 and 17:30:09 (?) did not.


Related issues

Has duplicate FreeNAS - Bug #27832: Email notification for "start of scrub" received with wrong "To" address shownClosed2018-01-16

History

#1 Avatar?id=14398&size=24x24 Updated by Kris Moore over 1 year ago

  • Assignee changed from Release Council to William Grzybowski
  • Priority changed from No priority to Important
  • Target version set to 11.2-BETA1
  • Seen in changed from Unspecified to TrueNAS 11.1-U1

#2 Updated by William Grzybowski over 1 year ago

  • Status changed from Unscreened to 15

How is your cron configured?

Do you have "Redirect Stdout" unchecked? What is the kind of output of your cron?

#3 Updated by John Newby over 1 year ago

  • Subject changed from Cron job no longerr emails with 11.1 to Cron job no longer emails with 11.1

Thanks. Yes, “Redirect Stdoutput” is unchecked – tried all combo’s of the two checkboxes (see comments in forum posting). The 09h00 today 11.0-U4 email output is here:

CPU 0: 31 C
CPU 1: 33 C
CPU 2: 32 C
CPU 3: 31 C
CPU 4: 32 C
CPU 5: 33 C
CPU 6: 31 C
CPU 7: 33 C

ada0 WD-WCC4EE8CZYX2: 27 C
ada1 WD-WCC4EE8CZU3S: 26 C
ada3 WD-WCC4E3A7ZF7K: 28 C
ada4 WD-WCC4EJUPN45U: 27 C

#4 Updated by Dru Lavigne over 1 year ago

  • Status changed from 15 to Screened

#5 Updated by William Grzybowski over 1 year ago

  • Status changed from Screened to 15

I simply cannot reproduce the issue you're having. I have got cron emails on 11.1 just fine.

Can you perhaps share the script you're running?

#6 Updated by John Newby over 1 year ago

William, thanks for the followup. I have been receiving 11.0-U4 emails every three hours from two boxes since filing the bug report. Today I booted them both into 11.1 at 14h30 - no emails at 15h00 - so behavior (still) consistent with my report.

Script's same on each box except for # of CPU's, # of disks and their designations:

#!/bin/sh

### Parameters ###
cores=8
drives="ada0 ada1 ada3 ada4" 

### CPU ###
echo "" 
cores=$((cores - 1))
for core in $(seq 0 $cores)
do
    temp="$(sysctl -a | grep "cpu.${core}.temp" | cut -c24-25 | tr -d "\n")" 
    printf "CPU %s: %s C\n" "$core" "$temp" 
done

### Disks ###
echo "" 
for drive in $drives
do
    serial="$(smartctl -i /dev/${drive} | grep "Serial Number" | awk '{print $3}')" 
    temp="$(smartctl -A /dev/${drive} | grep "Temperature_Celsius" | awk '{print $10}')" 
    printf "%s %-15s: %s C\n" "$drive" "$serial" "$temp" 
done
echo "" 

That's it.

#7 Updated by William Grzybowski over 1 year ago

I have this exact script running on cron in 11.1 and it works for me.

Have you tried sending a test email in System - Email? Does that work?

#8 Updated by William Grzybowski over 1 year ago

Also, can you get me the output of: "midclt call core.get_jobs| jq ."

#9 Updated by John Newby over 1 year ago

Thanks. Oh yes, test email works as expected.

11.0-U4 output:

root@freenasmini:~ # midclt call core.get_jobs| jq .
[ {
"id": 1,
"method": "update.download",
"arguments": [],
"progress": {
"percent": null,
"description": null,
"extra": null
},
"result": true,
"error": null,
"exception": null,
"state": "SUCCESS",
"time_started": {
"$date": 1515491641562
},
"time_finished": {
"$date": 1515491740660
}
}
]
root@freenasmini:~ #

11.1-RELEASE Output (Immediately after reboot from 11.0-U4)(11.1 install verifies OK):

root@freenasmini:~ # midclt call core.get_jobs| jq .
[]
root@freenasmini:~ #

Hmmm....
John N.

#10 Updated by William Grzybowski over 1 year ago

I need that midclt output only from 11.1. Did you run that after the cron was supposed to run?

#11 Updated by John Newby over 1 year ago

No. I gathered that afterwards and that's why I made the notation "(Immediately after reboot from 11.0-U4)".

Here goes (from a manual cron job run):

root@freenasmini:~ # midclt call core.get_jobs| jq .
[ {
"id": 1,
"method": "mail.send",
"arguments": [ {
"subject": "Cron <root@freenasmini> PATH=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin\" /bin/sh /nonexistent/scripts/cpuhddtemps.sh",
"text": "\nCPU 0: 36 C\nCPU 1: 37 C\nCPU 2: 36 C\nCPU 3: 37 C\nCPU 4: 39 C\nCPU 5: 37 C\nCPU 6: 36 C\nCPU 7: 36 C\n\nada0 WD-WCC4EE8CZYX2: 29 C\nada1 WD-WCC4EE8CZU3S: 29 C\nada3 WD-WCC4E3A7ZF7K: 29 C\nada4 WD-WCC4EJUPN45U: 29 C\n\n",
"interval": null,
"channel": null,
"to": [
"xxxxxxxxxxxxxx"
],
"timeout": 300,
"queue": true,
"extra_headers": {
"From": "xxxxxxxxxxxxxxxxxx",
"To": "root",
"Subject": "Cron <root@freenasmini> PATH=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin\" /bin/sh /nonexistent/scripts/cpuhddtemps.sh",
"X-Cron-Env": "<SHELL=/bin/sh>",
"X-Mailer": "FreeNAS",
"X-FreeNAS-Host": "freenasmini.local"
},
"attachments": false
}
],
"progress": {
"percent": null,
"description": null,
"extra": null
},
"result": null,
"error": "[EFAULT] Failed to send email: (550, b'Your message does not conform to RFC2822 standard')",
"exception": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.6/site-packages/middlewared/plugins/mail.py\", line 265, in send\n server.sendmail(config['fromemail'], to, msg.as_string())\n File \"/usr/local/lib/python3.6/smtplib.py\", line 888, in sendmail\n raise SMTPDataError(code, resp)\nsmtplib.SMTPDataError: (550, b'Your message does not conform to RFC2822 standard')\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.6/site-packages/middlewared/job.py\", line 282, in run\n await self.future\n File \"/usr/local/lib/python3.6/asyncio/coroutines.py\", line 128, in throw\n return self.gen.throw(type, value, traceback)\n File \"/usr/local/lib/python3.6/site-packages/middlewared/job.py\", line 337, in _run_body\n rv = await self.middleware.run_in_thread(self.method, *([self] + args))\n File \"/usr/local/lib/python3.6/asyncio/coroutines.py\", line 128, in throw\n return self.gen.throw(type, value, traceback)\n File \"/usr/local/lib/python3.6/site-packages/middlewared/main.py\", line 838, in run_in_thread\n return await self.run_in_thread_pool(self._threadpool, method, *args, **kwargs)\n File \"/usr/local/lib/python3.6/asyncio/coroutines.py\", line 128, in throw\n return self.gen.throw(type, value, traceback)\n File \"/usr/local/lib/python3.6/site-packages/middlewared/main.py\", line 834, in run_in_thread_pool\n await task\n File \"/usr/local/lib/python3.6/concurrent/futures/thread.py\", line 56, in run\n result = self.fn(*self.args, **self.kwargs)\n File \"/usr/local/lib/python3.6/site-packages/middlewared/schema.py\", line 495, in nf\n return f(*args, **kwargs)\n File \"/usr/local/lib/python3.6/site-packages/middlewared/plugins/mail.py\", line 278, in send\n raise CallError(f'Failed to send email: {e}')\nmiddlewared.service_exception.CallError: [EFAULT] Failed to send email: (550, b'Your message does not conform to RFC2822 standard')\n",
"state": "FAILED",
"time_started": {
"$date": 1515506409690
},
"time_finished": {
"$date": 1515506410580
}
}
]
root@freenasmini:~ #

Do you want the result of a programmed cron job run?
John N.

#12 Updated by William Grzybowski over 1 year ago

Your message does not conform to RFC2822 standard

That message is coming from your mail server. Do you have access to it to find out what exactly it doesn't like?
I dont know how else we can debug this since the server I have access to do think the mail message is valid.

#13 Updated by John Newby over 1 year ago

Thank you for the info. This is new territory for me - the mail server is that of my ISP Earthlink smtpauth.earthlink.net, so I suppose I'll have to approach them.
Any suggestions on what info from the output above I should feed them - everything between "error" and "FAILED"?
John N.

#14 Updated by William Grzybowski over 1 year ago

John Newby wrote:

Thank you for the info. This is new territory for me - the mail server is that of my ISP Earthlink smtpauth.earthlink.net, so I suppose I'll have to approach them.
Any suggestions on what info from the output above I should feed them - everything between "error" and "FAILED"?
John N.

Wait a minute, I think that may be because of the "To" header. I will get back to you soon.

#15 Updated by William Grzybowski over 1 year ago

Can you try changing file /etc/find_alias_for_smtplib.py line 65 from

        'To': to_addr,

to

        'To': ', '.join(to_addrs_repl),

#16 Updated by John Newby over 1 year ago

Yes, I'll come back "soon".

#17 Updated by John Newby over 1 year ago

OK, so made the requested change, saved it, rebooted, here follows the result of the last programmed cron attempt at 12h00 - which did not achieve an email:

{
"id": 5,
"method": "mail.send",
"arguments": [ {
"subject": "Cron <root@freenasmini> PATH=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin\" /bin/sh /nonexistent/scripts/cpuhddtemps.sh",
"text": "\nCPU 0: 36 C\nCPU 1: 37 C\nCPU 2: 35 C\nCPU 3: 37 C\nCPU 4: 37 C\nCPU 5: 38 C\nCPU 6: 36 C\nCPU 7: 36 C\n\nada0 WD-WCC4EE8CZYX2: 30 C\nada1 WD-WCC4EE8CZU3S: 29 C\nada3 WD-WCC4E3A7ZF7K: 30 C\nada4 WD-WCC4EJUPN45U: 29 C\n\n",
"interval": null,
"channel": null,
"to": [
"xxxxxxxxxxxxxxxx"
],
"timeout": 300,
"queue": true,
"extra_headers": {
"From": "xxxxxxxxxxxxx",
"To": "root",
"Subject": "Cron <root@freenasmini> PATH=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin\" /bin/sh /nonexistent/scripts/cpuhddtemps.sh",
"X-Cron-Env": "<SHELL=/bin/sh>",
"X-Mailer": "FreeNAS",
"X-FreeNAS-Host": "freenasmini.local"
},
"attachments": false
}
],
"progress": {
"percent": null,
"description": null,
"extra": null
},
"result": null,
"error": "[EFAULT] Failed to send email: (550, b'Your message does not conform to RFC2822 standard')",
"exception": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.6/site-packages/middlewared/plugins/mail.py\", line 265, in send\n server.sendmail(config['fromemail'], to, msg.as_string())\n File \"/usr/local/lib/python3.6/smtplib.py\", line 888, in sendmail\n raise SMTPDataError(code, resp)\nsmtplib.SMTPDataError: (550, b'Your message does not conform to RFC2822 standard')\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.6/site-packages/middlewared/job.py\", line 282, in run\n await self.future\n File \"/usr/local/lib/python3.6/asyncio/coroutines.py\", line 128, in throw\n return self.gen.throw(type, value, traceback)\n File \"/usr/local/lib/python3.6/site-packages/middlewared/job.py\", line 337, in _run_body\n rv = await self.middleware.run_in_thread(self.method, *([self] + args))\n File \"/usr/local/lib/python3.6/asyncio/coroutines.py\", line 128, in throw\n return self.gen.throw(type, value, traceback)\n File \"/usr/local/lib/python3.6/site-packages/middlewared/main.py\", line 838, in run_in_thread\n return await self.run_in_thread_pool(self._threadpool, method, *args, **kwargs)\n File \"/usr/local/lib/python3.6/asyncio/coroutines.py\", line 128, in throw\n return self.gen.throw(type, value, traceback)\n File \"/usr/local/lib/python3.6/site-packages/middlewared/main.py\", line 834, in run_in_thread_pool\n await task\n File \"/usr/local/lib/python3.6/concurrent/futures/thread.py\", line 56, in run\n result = self.fn(*self.args, **self.kwargs)\n File \"/usr/local/lib/python3.6/site-packages/middlewared/schema.py\", line 495, in nf\n return f(*args, **kwargs)\n File \"/usr/local/lib/python3.6/site-packages/middlewared/plugins/mail.py\", line 278, in send\n raise CallError(f'Failed to send email: {e}')\nmiddlewared.service_exception.CallError: [EFAULT] Failed to send email: (550, b'Your message does not conform to RFC2822 standard')\n",
"state": "FAILED",
"time_started": {
"$date": 1515517209664
},
"time_finished": {
"$date": 1515517209910
}
}
]
root@freenasmini:~ #

While waiting for that programmed event I had tried a manual cron run - had no email output. I also tried that on my backup machine on 11.0-U4 with same ISP, no email. I then set up the backup machine on my google email account, test email fine, 12h00 schedule cron email fine, manual cron run - no email. So looks like no email to std output with a manual cron run may be normal (?).

#18 Updated by William Grzybowski over 1 year ago

Make the changes and don't reboot please. The changes do not survive a reboot.

#19 Updated by John Newby over 1 year ago

Oh **

Back soon.

#20 Updated by William Grzybowski over 1 year ago

William Grzybowski wrote:

Make the changes and don't reboot please. The changes do not survive a reboot.

Also, you're right about Run Now, since that is not/cannot be triggered with cron(8)

#21 Updated by John Newby over 1 year ago

Here's the output now:

{
"id": 5,
"method": "mail.send",
"arguments": [ {
"subject": "Cron &lt;root@freenasmini&gt; PATH=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin\" /bin/sh /nonexistent/scripts/cpuhddtemps.sh",
"text": "\nCPU 0: 36 C\nCPU 1: 37 C\nCPU 2: 35 C\nCPU 3: 37 C\nCPU 4: 37 C\nCPU 5: 38 C\nCPU 6: 36 C\nCPU 7: 36 C\n\nada0 WD-WCC4EE8CZYX2: 30 C\nada1 WD-WCC4EE8CZU3S: 29 C\nada3 WD-WCC4E3A7ZF7K: 30 C\nada4 WD-WCC4EJUPN45U: 29 C\n\n",
"interval": null,
"channel": null,
"to": [
"xxxxxxxxxxxxxxxxxxx"
],
"timeout": 300,
"queue": true,
"extra_headers": {
"From": "xxxxxxxxxxxxxxxxxx",
"To": "root",
"Subject": "Cron &lt;root@freenasmini&gt; PATH=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin\" /bin/sh /nonexistent/scripts/cpuhddtemps.sh",
"X-Cron-Env": "&lt;SHELL=/bin/sh&gt;",
"X-Mailer": "FreeNAS",
"X-FreeNAS-Host": "freenasmini.local"
},
"attachments": false
}
],
"progress": {
"percent": null,
"description": null,
"extra": null
},
"result": null,
"error": "[EFAULT] Failed to send email: (550, b'Your message does not conform to RFC2822 standard')",
"exception": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.6/site-packages/middlewared/plugins/mail.py\", line 265, in send\n server.sendmail(config['fromemail'], to, msg.as_string())\n File \"/usr/local/lib/python3.6/smtplib.py\", line 888, in sendmail\n raise SMTPDataError(code, resp)\nsmtplib.SMTPDataError: (550, b'Your message does not conform to RFC2822 standard')\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.6/site-packages/middlewared/job.py\", line 282, in run\n await self.future\n File \"/usr/local/lib/python3.6/asyncio/coroutines.py\", line 128, in throw\n return self.gen.throw(type, value, traceback)\n File \"/usr/local/lib/python3.6/site-packages/middlewared/job.py\", line 337, in _run_body\n rv = await self.middleware.run_in_thread(self.method, *([self] + args))\n File \"/usr/local/lib/python3.6/asyncio/coroutines.py\", line 128, in throw\n return self.gen.throw(type, value, traceback)\n File \"/usr/local/lib/python3.6/site-packages/middlewared/main.py\", line 838, in run_in_thread\n return await self.run_in_thread_pool(self._threadpool, method, *args, **kwargs)\n File \"/usr/local/lib/python3.6/asyncio/coroutines.py\", line 128, in throw\n return self.gen.throw(type, value, traceback)\n File \"/usr/local/lib/python3.6/site-packages/middlewared/main.py\", line 834, in run_in_thread_pool\n await task\n File \"/usr/local/lib/python3.6/concurrent/futures/thread.py\", line 56, in run\n result = self.fn(*self.args, **self.kwargs)\n File \"/usr/local/lib/python3.6/site-packages/middlewared/schema.py\", line 495, in nf\n return f(*args, **kwargs)\n File \"/usr/local/lib/python3.6/site-packages/middlewared/plugins/mail.py\", line 278, in send\n raise CallError(f'Failed to send email: {e}')\nmiddlewared.service_exception.CallError: [EFAULT] Failed to send email: (550, b'Your message does not conform to RFC2822 standard')\n",
"state": "FAILED",
"time_started": {
"$date": 1515517209664
},
"time_finished": {
"$date": 1515517209910
}
}
]
root@freenasmini:/etc #

Or must we use the output of a programmed run? I set one up for 13h00.

John N.

#22 Updated by William Grzybowski over 1 year ago

Its still using "To": "root"

Can you attach the file you modified?

Perhaps you can do a TeamViewer?

#23 Updated by John Newby over 1 year ago

Yes I can attach the file I modified once I find out how. Same with Team Viewer. I'll get back with you asap.
Thanks again.

#24 Updated by John Newby over 1 year ago

Here's the file content:
#!/usr/local/bin/python

import argparse
import email
import email.parser
import os
import re
import socket
import sys
import syslog

from django.utils.translation import ugettext_lazy as _

sys.path.extend(["/usr/local/www", "/usr/local/www/freenasUI"])

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'freenasUI.settings')

import django
django.setup()

from freenasUI.common.system import get_sw_name, send_mail
from freenasUI.system.models import Email

ALIASES = re.compile(r'^(?P<from>[^#]\S+?):\s*(?P<to>\S+)$')

def do_sendmail(msg, to_addrs=None, parse_recipients=False):

if to_addrs is None:
if not parse_recipients:
syslog.syslog('Do not know who to send the message to.' + msg[0:140])
raise ValueError('Do not know who to send the message to.')
to_addrs = []
  1. XXX: this should probably be a FeedParser because reading from sys.stdin
  2. is blocking.
    em_parser = email.parser.Parser()
    em = em_parser.parsestr(msg)
    if parse_recipients: # Strip away the comma based delimiters and whitespace.
    to_addrs = list(map(str.strip, em.get('To').split(',')))
if not to_addrs or not to_addrs[0]:
to_addrs = ['root']
to_addrs_repl = []
if to_addrs:
aliases = get_aliases()
for to_addr in to_addrs:
for to_addr in to_addr.split(','):
if to_addr.find('') != -1:
to_addrs_repl.append(to_addr)
elif to_addr.find('
') == -1 and to_addr in aliases:
to_addrs_repl.append(aliases[to_addr])
if not to_addrs_repl:
syslog.syslog(f'No aliases found to send email to {", ".join(to_addrs)}')
sys.exit(1)
margs = {}
margs['extra_headers'] = dict(em)
margs['extra_headers'].update({
'X-Mailer': get_sw_name(),
'X-%s-Host' % get_sw_name(): socket.gethostname(),
'To': ', '.join(to_addrs_repl),
})
margs['subject'] = em.get('Subject')
  1. abusive use of querysets
    lemail = Email.objects.all()
    for obj in lemail:
    if obj.em_fromemail != '':
    margs['extra_headers'].update({
    'From': obj.em_fromemail
    })
if em.is_multipart():
margs['attachments'] = [part for part in em.walk() if part.get_content_maintype() != 'multipart']
margs['text'] = "%s" % _(
'This is a MIME formatted message. If you see '
'this text it means that your email software '
'does not support MIME formatted messages.')
else:
margs['text'] = ''.join(email.iterators.body_line_iterator(em))
margs['to'] = to_addrs_repl
send_mail(**margs)

def get_aliases():
with open('/etc/aliases', 'r') as f:
aliases = {}

for line in f.readlines():
search = ALIASES.search(line)
if search:
_from, _to = search.groups()
aliases[_from] = _to
doround = True
while True:
if not doround:
break
else:
doround = False
for key, val in aliases.items():
if val in aliases:
aliases[key] = aliases[val]
doround = True
return aliases

def main():
syslog.openlog(logoption=syslog.LOG_PID, facility=syslog.LOG_MAIL)
parser = argparse.ArgumentParser(description='Process email')
parser.add_argument('-i', dest='strip_leading_dot', action='store_false',
default=True, help='see sendmail(8) -i')
parser.add_argument('-t', dest='parse_recipients', action='store_true',
default=False,
help='parse recipients from message')
parser.usage = ' '.join(parser.format_usage().split(' ')[1:-1])
parser.usage += ' [email_addr|user] ..'
args, to = parser.parse_known_args()
if not to and not args.parse_recipients:
parser.exit(message=parser.format_usage())
msg = sys.stdin.read()
syslog.syslog("sending mail to " + ','.join(to) + msg[0:140])
do_sendmail(msg, to_addrs=to, parse_recipients=args.parse_recipients)

if name == "__main__":
main()
--More--(END)

Team Viewer research now.

#25 Updated by John Newby over 1 year ago

Team Viewer up and running now. You'll have to coach me on the connection - I have here an ID and a password - my assumption is that you need those to come in as a remote connection?

#26 Updated by John Newby over 1 year ago

Update - I just got a programmed cron job email from the box with 11.1-RELEASE and the modified file /etc/find_alias_for_smtplib.py line 65

Sounds like progress!

#27 Updated by William Grzybowski over 1 year ago

John Newby wrote:

Update - I just got a programmed cron job email from the box with 11.1-RELEASE and the modified file /etc/find_alias_for_smtplib.py line 65

Sounds like progress!

Great!

Can you get me the output of "midclt call core.get_jobs | jq ."

It sounds like we will not need TeamViewer anymore if it started working ;)

#28 Updated by John Newby over 1 year ago

Here we go:

{
"id": 6,
"method": "mail.send",
"arguments": [ {
"subject": "Cron &lt;root@freenasmini&gt; PATH=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin\" /bin/sh /nonexistent/scripts/cpuhddtemps.sh",
"text": "\nCPU 0: 41 C\nCPU 1: 41 C\nCPU 2: 41 C\nCPU 3: 40 C\nCPU 4: 41 C\nCPU 5: 41 C\nCPU 6: 40 C\nCPU 7: 39 C\n\nada0 WD-WCC4EE8CZYX2: 30 C\nada1 WD-WCC4EE8CZU3S: 29 C\nada3 WD-WCC4E3A7ZF7K: 30 C\nada4 WD-WCC4EJUPN45U: 30 C\n\n",
"interval": null,
"channel": null,
"to": [
"xxxxxxxxxxxxxxxxxxxx"
],
"timeout": 300,
"queue": true,
"extra_headers": {
"From": "yyyyyyyyyyyyyyyyyyyyy",
"To": "zzzzzzzzzzzzzzzzzzzzz",
"Subject": "Cron &lt;root@freenasmini&gt; PATH=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin\" /bin/sh /nonexistent/scripts/cpuhddtemps.sh",
"X-Cron-Env": "&lt;SHELL=/bin/sh&gt;",
"X-Mailer": "FreeNAS",
"X-FreeNAS-Host": "freenasmini.local"
},
"attachments": false
}
],
"progress": {
"percent": null,
"description": null,
"extra": null
},
"result": true,
"error": null,
"exception": null,
"state": "SUCCESS",
"time_started": {
"$date": 1515520809912
},
"time_finished": {
"$date": 1515520810196
}
}
]
root@freenasmini:~ #

#29 Updated by William Grzybowski over 1 year ago

  • Status changed from 15 to Ready For Release
  • Target version changed from 11.2-BETA1 to 11.1-U1
  • Seen in changed from TrueNAS 11.1-U1 to 11.1

Awesome, that is working as intended, correct "To" header.

Thanks for the help and fast feedbacks!

https://github.com/freenas/freenas/pull/666
https://github.com/freenas/freenas/pull/667

#30 Updated by Dru Lavigne over 1 year ago

  • Subject changed from Cron job no longer emails with 11.1 to Fix for alert emails being improperly addressed

#31 Updated by Dru Lavigne over 1 year ago

  • Status changed from Ready For Release to Resolved

#32 Updated by Bonnie Follweiler over 1 year ago

  • Needs QA changed from Yes to No
  • QA Status Test Passes FreeNAS added
  • QA Status deleted (Not Tested)

#33 Updated by Dru Lavigne over 1 year ago

  • Has duplicate Bug #27832: Email notification for "start of scrub" received with wrong "To" address shown added

Also available in: Atom PDF