这是我正在使用的代码(在声明模型之后):
def order_update(sender, instance, created, **kwargs):
subject = 'subject'
from_email = 'sender@mail.com'
to = 'receiver@mail.com'
text_content = f'text'
html_content = f'html'
msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
msg.attach_alternative(html_content, "text/html")
msg.send(fail_silently=False)
post_save.connect(order_update, sender=Order)
在localhost上运行良好,每当创建对象时都会发送一封电子邮件。
但是,当我将其上传到实时环境Ubuntu 16.04时,它会出现以下错误:SMTP AUTH extension not supported by server.
。