09-02-2020, 18:32
It seems that sendmail.py script don't know the variables defined in the main script.
I managed to have an email from script by changing the sensmail script :
No sure it is a good solution
I managed to have an email from script by changing the sensmail script :
Code:
#
# function to send a mail
#
def sendmail(recipient,subject,content):
from email.mime.text import MIMEText
import smtplib
# generate a RFC 2822 message
sender = 'Sender@mail.com'
smtpserver = 'smtp.free.fr'
msg = MIMEText(content)
msg['From'] = sender
msg['To'] = recipient
msg['Subject'] = subject
# open SMTP connection
server = smtplib.SMTP(smtpserver)
# start TLS encryption
#if usetls:
#server.starttls()
# login with specified account
#if smtpusername and smtppassword:
#server.login(smtpusername,smtppassword)
# send generated message
server.sendmail(sender,recipient,msg.as_string())
# close SMTP connection
server.quit()
Laurent

