Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在私人电信smtp上发送电子邮件?_Python_Email_Smtp - Fatal编程技术网

Python 如何在私人电信smtp上发送电子邮件?

Python 如何在私人电信smtp上发送电子邮件?,python,email,smtp,Python,Email,Smtp,我想自动发送电子邮件,但收到以下错误消息: “连接意外关闭:[Errno 104]对等方重置连接” 我尝试了一些smtp服务器方法,但无法工作 我的代码在这里: fromaddr = "test@gmail.com" toaddr = "test2@gmail.com" msg = MIMEMultipart() msg['From'] = fromaddr msg['To'] = toaddr msg['Subject'] = "test" body = "Test" msg.attach(M

我想自动发送电子邮件,但收到以下错误消息: “连接意外关闭:[Errno 104]对等方重置连接”

我尝试了一些smtp服务器方法,但无法工作

我的代码在这里:

fromaddr = "test@gmail.com"
toaddr = "test2@gmail.com"
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = "test"
body = "Test"
msg.attach(MIMEText(body, 'plain')) 
#server = smtplib.SMTP('smtp.example.com', 25)
server = smtplib.SMTP_SSL('mail.dt-one.com', 443)
#server.connect("mail.t-online.hu",2525)
server.ehlo()
server.starttls()
server.ehlo()
server.login('myuser','mypassword')
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()

你对港口有把握吗?对于使用SSL的SMTP,我希望是465或587,当然不是443。我不确定这个443。我用465和587检查它。我也用465和587检查“连接超时”。
连接超时
!=<代码>连接意外关闭。无论如何,我们在这里帮不了什么忙,因为我们没有关于邮件服务器的详细信息。请获取有关正确端口和使用何种技术的详细信息(例如SMTP、通过TLS的SMTP或通过SSL的SMTP)。