Home>

There is a small chapel creaking on python to send a test letter. In general below the code

Import SMTPLIB
From email.mime.multipart Import Mimemultipart
From email.mime.Text Import MimeText
from email.mime.image Import Mimeimage
Email_host= 'smtp.gmail.com'
Email_host_user= '******'
Email_host_password= '********'
Email_Port= 587.
ADDR_TO= "*********"
msg= mimemultipart () # Create a message
msg ['from']= email_host_user # recipient
msg ['to']= addr_to # recipient
MSG ['SUBJECT']= 'Message topic' # Message topic
Body= "Message Text"
MSG.attach (MimeText (Body, 'Plain')) add to the message text
Server= smtplib.smtp (email_host, email_port) Create an SMTP object
server.set_debuglevel (true) Include debugging mode -if the report is not needed, the string can be commented
Server.startTls () # start encrypted TLS exchange
Server.login (email_host_user, email_host_password) # Get access
Server.send_message (MSG) # send a message
Server.Quit ()

I want to run it on the hosting using Cron.V CPanel there is a link to create a task in the starting page. Below the settings that I enter, but the task is not performed. In errors, too, nothing can be seen On hosting in the terminal, I start the script after activating the virtual environment. Maybe this is the problem

I start after activating a virtual environment -you do it, you probably perform something like $ SOURCE /Some /way /Activate. So stood into your script as Shembang #! /Some /way /Python. Or call the script, indicating the path to the interpreter explicitly: $ /Some /way /Python /path /to /your /script

aleksandr barakin2021-05-06 10:32:07