Sending email. Email with Cyrillic characters is not being sent
📁 Advanced Python Topics, Error, python3, work
Goal: Need to send an email. The email contains Cyrillic characters.
Problem: The script works with Latin characters but does not work with Cyrillic
Script:
import smtplibTEXT = ""Cyrillic ""\\ ""Cyrillic""TO = 'xxxxxx@gmail.com'SUBJECT = 'xxxx'# Gmail Sign Ingmail_sender = 'xxxx@gmail.com'gmail_passwd = 'xxxxxx'server = smtplib.SMTP('smtp.gmail.com', 587)server.ehlo()server.starttls()server.login(gmail_sender, gmail_passwd)BODY = '\\r'.join(['To: %s @staticmethod is used when your method does not have any access to what the class or class instance represents. It does not take any mandatory arguments like the class instance or the class itself.
In your first method, the self parameter is passed, which can be used later in the code (even if you don't use it). In the @staticmethod variant, there is no way to access the class or instance. It is called the same way as a regular method.
More details can be read here:
Log in to leave an answer