Forums

Task not working

Hello, I created a Task with this command:

python3.8 /home/vittus/mysite/scadenze.py

but it doesn't start. I view the task log and this is what was written:

Traceback (most recent call last):
File "/home/vittus/mysite/scadenze.py", line 27, in <module>
yag.send(to='vittus69@gmail.com', subject='Nuova Scadenza', contents='Ciao vittorio, hai una nuova   scadenza!')
File "/home/vittus/.local/lib/python3.8/site-packages/yagmail/sender.py", line 153, in send
self.login()
File "/home/vittus/.local/lib/python3.8/site-packages/yagmail/sender.py", line 206, in login
self._login(self.credentials)
File "/home/vittus/.local/lib/python3.8/site-packages/yagmail/sender.py", line 225, in _login
self.smtp.login(self.user, password)
File "/usr/lib/python3.8/smtplib.py", line 734, in login
raise last_exception
File "/usr/lib/python3.8/smtplib.py", line 723, in login
(code, resp) = self.auth(
File "/usr/lib/python3.8/smtplib.py", line 646, in auth
raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (534, b'5.7.14 <https://accounts.google.com/signin/continue?sarp=1&   scc=1&plt=AKgnsbt\n5.7.14   XZ1unKBtiz6ZUT3GqWy7U1Y1P98T4eQOoI01q6oiiHRaIYV9a84tRqWUnbIJrTj2ie8Pj\n5.7.14 wZF_5TZtxKfFFMHxVux7WKPnwTTrwhRprw2UlahyOgX1mK6pR1PfIC3_GDX9HW3r>\n5.7.14 Please log in via your web browser and then try again.\n5.7.14  Learn more at\n5.7.14  https://support.google.com/mail/answer/78754 l28sm11822011qkl.7 - gsmtp')

2020-11-29 17:01:37 -- Completed task, took 22.67 seconds, return code was 1.

If I run manually the same file it works perfectly. What am I missing? Thank you

Now it's no longer working either manually, maybe the problem is not in the task! :(

GMail have higher security requirements for code connecting to their server from cloud computing environments, and sometimes they change the IP addresses that they regard as being cloud computing ones. The best solution is to use an app-specific password as per the bottom section, "Google security blocking and setting up an App-Specific password", of this help page. (The help page as a whole it regarding free accounts but that specific section applies to all accounts including paid ones.)

Thank you, I will surely try. It's very strange, this morning it worked manually, yesterday afternoon it didn't. The Task instead never worked (gives me always the SMTPAuthenticationError)

Ok thank you, now it works!

Glad to see!