Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

EG with e-mail support for error messages....

Got a good idea? You can suggest new features here.
Post Reply
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

EG with e-mail support for error messages....

Post by krambriw »

Hallo,

I was searching the term "mail" but couldnt find what I was looking for....

What about to add e-mail support to EG?

If there are error conditions detected by EG and shown in the log I would like to send (selected) alerts to my email (handy).

It would be ok with a script but an email plug-in would be great

Best regards, Walter
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: EG with e-mail support for error messages....

Post by krambriw »

Bump
Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Re: EG with e-mail support for error messages....

Post by Bartman »

You should be able to send mail with a hand full lines of python code. I have a python script sending mail outside EG. I can test if it runs within EG.
But there is no special event for errors. There is no common behaviour on errors in the plugins.
I have thought about asking for a special eventtype for error too...
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: EG with e-mail support for error messages....

Post by krambriw »

Hallo Bartman,

Yes, this would be interesting to build something on.

In my case, and I believe others too, I run EG 24/7/365 and it would not be nice if it stops (I even have another software monitoring that EG is running...) and therefore it would be very important to know if for instance my script stops executing.

With your script for email it might be possible to do something like this;

Lets say you have a main script that is running (on timer or scheduler). The script also updates a counter or toggles a flag every time it executes. This flag is defined as an eg.global variabel.

Your mail script runs also on timer/scheduler and if it recognizes that the counter/flag has been the same for a couple of runs, it could send a mail.

Of course this only monitors your main script but its better then nothing...

Best regards
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: EG with e-mail support for error messages....

Post by krambriw »

Dear Bartman,

Have you made any tries regarding sending mail from EG?
Do you have a sample script you could publish?

BestR Walter
Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Re: EG with e-mail support for error messages....

Post by Bartman »

I totally forgot about it.

Code: Select all

import smtplib

def mail(to, text, subject):
    headers = "From: \"your name\" <[email protected]>To: %s\r\nSubject: %s\r\n\r\n" % (to, subject)
    message = headers + text
    mailServer = smtplib.SMTP("smtp.address.com")
    mailServer.login("user", "password")
    mailServer.sendmail("[email protected]", to, message)
    mailServer.quit()
    
mail("recipient", "EG Test", "subject");
Make sure you replace all the placeholders
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: EG with e-mail support for error messages....

Post by krambriw »

Thanks a lot Bartman,
BestR Walter
Post Reply