[英]python email script doesn't work on mac os x 10.9
I started trying to make a script to send emails using python, but nothing worked. 我开始尝试制作一个脚本来使用python发送电子邮件,但是没有任何效果。 I eventually got to the point where I just started copying and pasting email scripts and filling in my info.
最终我到达了开始复制和粘贴电子邮件脚本并填写我的信息的地步。 Still nothing worked.
仍然没有任何效果。 So i eventually just got rid of everything except this:
所以我最终摆脱了一切,除了:
#!/usr/bin/python
import smtplib
This still did not work. 这仍然没有用。 Can someone explain to me why this doesn't work?
有人可以向我解释为什么这行不通吗? I'm sure its really simple.
我相信它真的很简单。 I'm using mac os x 10.9 if that makes a difference.
我正在使用mac os x 10.9(如果有所作为)。 here is my error:
这是我的错误:
Traceback (most recent call last):
File "the_email.py", line 2, in <module>
import smtplib
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 46, in <module>
import email.utils
ImportError: No module named utils
Change the name of your script from email.py
to something else. 将脚本名称从
email.py
更改为其他名称。 It is interfering with the Python standard library module of the same name, email
. 它干扰了同名的Python标准库模块
email
。
Read this: Syntax: python smtplib not working in script 阅读: 语法:python smtplib在脚本中不起作用
A user says that you have to remove email.py from the folder. 用户说您必须从文件夹中删除email.py。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.