i see consumers for social media but not for email - perhaps my oversight, but is an email consumer already written and available?
i have written an email consumer and happy to contribute it the code base - i don’t know the process. unfamiliar with the forum tool so i am hoping the following is an upload of the Emailer class:
c_emailer.py (9.8 KB)
the insertion to client.c is:
from rsudp.c_emailer import Emailer
…
▸···if 'emailer' in settings and settings['emailer'].get('enabled', False):
▸···▸···try:
▸···▸···▸···emailer = Emailer(settings['emailer'])
▸···▸···▸···emailer.assign_q(mk_q())
▸···▸···▸···mk_p(emailer)
▸···▸···except KeyError as e:
▸···▸···▸···printW(f"emailer missing {e.args[0]}, skipping")
and it was a deliberate design decision to make the option processing inside the Emailer class, and let it raise a configuration error
Hello ge1,
As of before your second message, no, an emailer consumer was not implemented in our latest available RSUDP version.
It would probably have gone inside the vast “set” that is the “custom” consumer services.
Thank you so much for creating a new module for RSDUP! Loving this!
I can take care of implementing it in a future release. Could you provide how you’ve modified the settings .json file to include this new module, and any other element you deem important?
I will, of course, credit you for all the work you’ve done.
the main comments are in the Emailer class doc-string, copied below:
emails are sent to localhost:25, where a locally running smtp server
is expected to deal with it, typically just forwarding it to a hub.
there is no authentication or encryption to the localhost smtp server
DATA messages are not supported. they are far too frequent for it to
be feasible to email them all
settings file contains
"emailer": {
"enabled": true,
"sender": “[email protected]", # email From (mandatory)
"recipients": [“[email protected]"], # email To (mandatory)
"subject_prefix": null, # prepended to subject
"body_default": null, # default body of text
"on_start": true, # send when processing starts
"on_alarm": true, # send on ALARM message
"on_reset": true, # send on RESET message
"on_imgpath": true, # send on IMGPATH message
"on_term": true, # send on TERM message
"trace": false}, # log each email sent
note that sender & recipients are mandatory, the flags default to true
except trace (false).
i set subject_prefix to “rsudp: “ and body_default to “[deliberately blank]”, and on_reset to false because it is soon followed by an emailed IMGPATH plot file
i know very little about windoze, but on any *nix platform a simple postfix configured as a no-local-mail-satellite suffices for local mailer (easily googled or, in my case, duckduckgo’ed for details)