使用带有SMTP的Gmail发送电子邮件时出错(Python 3)
我试图在Python 3.4中使用SMTP发送电子邮件,但在运行代码时收到以下错误:使用带有SMTP的Gmail发送电子邮件时出错(Python 3),python,email,smtp,Python,Email,Smtp,我试图在Python 3.4中使用SMTP发送电子邮件,但在运行代码时收到以下错误: Traceback (most recent call last): File "C:/Users/Anna Hughes/Documents/Python Projects/2015.10.16/Mail Application.py", line 9, in <module> server.login(user_email, user_password) File "C:\Pyt
Traceback (most recent call last):
File "C:/Users/Anna Hughes/Documents/Python Projects/2015.10.16/Mail Application.py", line 9, in <module>
server.login(user_email, user_password)
File "C:\Python34\lib\smtplib.py", line 613, in login
raise SMTPException("SMTP AUTH extension not supported by server.")
smtplib.SMTPException: SMTP AUTH extension not supported by server.
谢谢
编辑:
我已经按照建议将第二行更改为server=smtplib.SMTP(“smpt.gmail.com,587”)
。这似乎修复了错误,但我现在得到一个新的:
Traceback (most recent call last):
File "C:/Users/Anna Hughes/Documents/Python Projects/2015.10.16/Mail Application.py", line 2, in <module>
server = smtplib.SMTP("smtp.gmail.com,587")
File "C:\Python34\lib\smtplib.py", line 242, in __init__
(code, msg) = self.connect(host, port)
File "C:\Python34\lib\smtplib.py", line 321, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "C:\Python34\lib\smtplib.py", line 292, in _get_socket
self.source_address)
File "C:\Python34\lib\socket.py", line 494, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "C:\Python34\lib\socket.py", line 533, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed
回溯(最近一次呼叫最后一次):
文件“C:/Users/Anna Hughes/Documents/Python Projects/2015.10.16/Mail Application.py”,第2行,在
server=smtplib.SMTP(“SMTP.gmail.com,587”)
文件“C:\Python34\lib\smtplib.py”,第242行,在\uuu init中__
(代码,消息)=自连接(主机,端口)
文件“C:\Python34\lib\smtplib.py”,第321行,在connect中
self.sock=self.\u获取\u套接字(主机、端口、self.timeout)
文件“C:\Python34\lib\smtplib.py”,第292行,在\u get\u套接字中
self.source(地址)
文件“C:\Python34\lib\socket.py”,第494行,位于create\u connection中
对于getaddrinfo(主机、端口、0、SOCK_流)中的res:
文件“C:\Python34\lib\socket.py”,第533行,在getaddrinfo中
对于_socket.getaddrinfo(主机、端口、系列、类型、协议、标志)中的res:
socket.gaierror:[Errno 11001]getaddrinfo失败
我认为您的问题可能在于:server=smtplib.SMTP(“SMTP.gmail.com:587”)
我有一些发送电子邮件的程序,我使用以下格式:server=smtplib.SMTP(“SMTP.gmail.com,587”)
如果您一开始看不到差异,冒号已更改为逗号。
希望这能解决它 我认为您的问题可能在于:
server=smtplib.SMTP(“SMTP.gmail.com:587”)
我有一些发送电子邮件的程序,我使用以下格式:server=smtplib.SMTP(“SMTP.gmail.com,587”)
如果您一开始看不到差异,冒号已更改为逗号。
希望这能解决它 我认为您的问题可能在于:
server=smtplib.SMTP(“SMTP.gmail.com:587”)
我有一些发送电子邮件的程序,我使用以下格式:server=smtplib.SMTP(“SMTP.gmail.com,587”)
如果您一开始看不到差异,冒号已更改为逗号。
希望这能解决它 我认为您的问题可能在于:
server=smtplib.SMTP(“SMTP.gmail.com:587”)
我有一些发送电子邮件的程序,我使用以下格式:server=smtplib.SMTP(“SMTP.gmail.com,587”)
如果您一开始看不到差异,冒号已更改为逗号。
希望这能解决它 您也可以尝试:
使用pip安装yagmail
进行安装
在github页面上可以找到更多的技巧,例如无密码脚本。您也可以尝试:
使用pip安装yagmail
进行安装
在github页面上可以找到更多的技巧,例如无密码脚本。您也可以尝试:
使用pip安装yagmail
进行安装
在github页面上可以找到更多的技巧,例如无密码脚本。您也可以尝试:
使用pip安装yagmail
进行安装
在github页面上可以找到更多的技巧,比如无密码脚本。我可以提供帮助
试试这个
import smtplib
Server=smtplib.SMTP('smtp.gmail.com',587)
Server.starttls()
Server.login("EMAIL_YOUR","YOUR_PASSWORD")
msg="Hello, Its the Message!"
Server.sendmail("whom_2_send@gmail.com","your_email@gmail.com",msg)
print("email send succesfully") #Just for confirmation
Server.quit()
试试这个
import smtplib
Server=smtplib.SMTP('smtp.gmail.com',587)
Server.starttls()
Server.login("EMAIL_YOUR","YOUR_PASSWORD")
msg="Hello, Its the Message!"
Server.sendmail("whom_2_send@gmail.com","your_email@gmail.com",msg)
print("email send succesfully") #Just for confirmation
Server.quit()
试试这个
import smtplib
Server=smtplib.SMTP('smtp.gmail.com',587)
Server.starttls()
Server.login("EMAIL_YOUR","YOUR_PASSWORD")
msg="Hello, Its the Message!"
Server.sendmail("whom_2_send@gmail.com","your_email@gmail.com",msg)
print("email send succesfully") #Just for confirmation
Server.quit()
试试这个
import smtplib
Server=smtplib.SMTP('smtp.gmail.com',587)
Server.starttls()
Server.login("EMAIL_YOUR","YOUR_PASSWORD")
msg="Hello, Its the Message!"
Server.sendmail("whom_2_send@gmail.com","your_email@gmail.com",msg)
print("email send succesfully") #Just for confirmation
Server.quit()
试试这个:
server = smtplib.SMTP('localhost')
server.set_debuglevel(1)
server.sendmail(email, password, message)
server.quit()
试试这个:
server = smtplib.SMTP('localhost')
server.set_debuglevel(1)
server.sendmail(email, password, message)
server.quit()
试试这个:
server = smtplib.SMTP('localhost')
server.set_debuglevel(1)
server.sendmail(email, password, message)
server.quit()
试试这个:
server = smtplib.SMTP('localhost')
server.set_debuglevel(1)
server.sendmail(email, password, message)
server.quit()