django EmailMultiAlternations-ValueError位于/。。。需要超过1个值才能解包
我不知道我为什么会犯这个错误。这是我几乎可以肯定问题所在的代码django EmailMultiAlternations-ValueError位于/。。。需要超过1个值才能解包,django,Django,我不知道我为什么会犯这个错误。这是我几乎可以肯定问题所在的代码 tekst = "Your credetials " + login + haslo + ". Activation key " + klucz contex = Context({"klucz" : klucz,"login" : login,"haslo" : haslo}) template = loader.get_template("aktywacja/email_aktywacyjny.html") html =
tekst = "Your credetials " + login + haslo + ". Activation key " + klucz
contex = Context({"klucz" : klucz,"login" : login,"haslo" : haslo})
template = loader.get_template("aktywacja/email_aktywacyjny.html")
html = template.render(contex)
email = EmailMultiAlternatives("Welcome",tekst,"Team",[email])
email.attach_alternative(html,"text/html")
email.send()
变量是有效的,并且来自is_valid()方法之后的表单。
以下是回溯:
Traceback:
File "D:\Programy\python27\lib\site-packages\django-1.2.4-py2.7.egg\django\core\handlers\base.py" in get_response
100. response = callback(request, *callback_args, **callback_kwargs)
File "C:\Users\Artur\Desktop\\views.py" in rejestracja
50. email.send()
File "D:\Programy\python27\lib\site-packages\django-1.2.4-py2.7.egg\django\core\mail\message.py" in send
179. return self.get_connection(fail_silently).send_messages([self])
File "D:\Programy\python27\lib\site-packages\django-1.2.4-py2.7.egg\django\core\mail\backends\smtp.py" in send_messages
85. sent = self._send(message)
File "D:\Programy\python27\lib\site-packages\django-1.2.4-py2.7.egg\django\core\mail\backends\smtp.py" in _send
103. from_email = self._sanitize(email_message.from_email)
File "D:\Programy\python27\lib\site-packages\django-1.2.4-py2.7.egg\django\core\mail\backends\smtp.py" in _sanitize
95. name, domain = email.split('@', 1)
有人能帮忙吗?
致以最诚挚的问候错误源于尝试使用
@
拆分而失败
email=EmailMultiAlternatives("Welcome",tekst,"Team",[email])
“团队”
需要是电子邮件地址
>>> name, domain = 'Team'.split('@', 1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: need more than 1 value to unpack
>>>
名称,域='Team'。拆分('@',1)
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
ValueError:需要超过1个值才能解包
>>>