How to read file content and send email on Debian Bullseye

^Bart gabriele1NOSPAM at hotmail.com
Sun Feb 5 05:46:00 EST 2023


> Not Python, but you could run a shell script that sends the file with 
> lftp, and depending on the return code uses xdg-email to send one of the 
> two messages. This would probably be simpler than using Python.

This machine is a server without DE, just command line and I didn't 
configure mail client so maybe I should use something like ssmtp.

> Otherwise you haven't said what part of the process you need help with. 
> Reading the log file?  Checking the date?  Triggering the Python script? 
>   Sending the email message with Python?

I need to understand "just" if the upload job is finished and, I think, 
the best way is to read the log file so I should write a code like:

"if there's a line with the same date of the machine than send email 
with ok else send an email with failed"

I do just an upload every day, from monday to friday so I don't have in 
the same day other lines.

> For the latter, it's covered in the Python docs -
> 
> https://docs.python.org/3.10/library/email.examples.html

I'm reading it! :)

Regards.
^Bart



More information about the Python-list mailing list