How to read file content and send email on Debian Bullseye

Jim Jackson jj at franjam.org.uk
Sun Feb 5 13:06:43 EST 2023


On 2023-02-05, ^Bart <gabriele1NOSPAM at hotmail.com> wrote:
>> xdg-email appears to be for interactive use (it opens the user's
>> "preferred email composer"); I think sendmail would work much better
>> from a script.
>
> Like what I said in another post I think I could use ssmtp than 
> xdg-email or sendmail...
>
>> Otherwise, I had the same initial thought, to add to and/or build a
>> wrapper around the existing lftp script.
>
> I'd like to know if there's a code made from lftp to understand when an 
> upload file is finished

You make an lftp "script" to upload the file and write a log somewhere - 
write a script to run lftp with the lftp script, when the lftp has 
finished email the log. The log will show what happenned.

In cron run the script.

>  but certainly I can read it from the log file 
> and I think it couldn't be hard to find a value in a *.txt file and if 
> this value is inside of it to send an email like "ok" otherwise a 
> message with "k.o.".
>
> Regards.
> ^Bart


More information about the Python-list mailing list