Open ThrowSyntaxError opened 2 years ago
How are you using yagmail
你如何使用亚格邮件
I smply use it just like this
class mailManager:
def __init__(self):
self.User = 'sender@mail.com'
self.PassWord = '**********'
self.SMTPClient = yagmail.SMTP(
host='smtp.EmailServer.com',
user=self.User,
password=self.PassWord,
port=465
)
def sendMail(self, receiver, subject, text):
try:
self.SMTPClient.send(receiver, subject, text)
print("Successfully sending e-mail!")
except Exception:
print("Error while sending e-mail:", Exception)
Try creating the smtp client right before sending all the time
Try creating the smtp client right before sending all the time
Acturally I just create a new mialManager instance in file app.py and not using sendMail function yet. I've switched to smptlib module in my app temporarily, but I still wanna figure it out. I notice that sometimes you need create a connection by using smtplib.SMTP_SSL() instead of smtplib.SMTP() in smtplib module, is this one of the possible reasons?
here is some error message: Exception ignored in: <function SMTP.del at 0x7f60bed18430>
description: I'm gonna test the function of sending email by using yagmail module in my app,but when I running my project the above problem occurred. dose it exist an error in source code? or just my fault? How should I solve this problem?
here is the code for the corresponding location above: