Python 3.4 Email

I really can't figure it out. Basically, I can easily send an email to myself using python without any problems, now I will use a mail server. The same type of transaction as the googles server for sending email. But I get this dumb problem by stating that my SSL handshake is incorrect, although I don't even use SSL. Here is my code.

server = smtplib.SMTP ()
server.connect("mail.xxxxx.com:587")
server.set_debuglevel(True)

server.starttls()
server.ehlo()

server.login(sender, "xxxxx")

server.sendmail(sender, reciever[1], Msg)

So basically, if I put mail.google or something that it should work? This happens, but with my new mail it is not, and I do not know why. Here is the error I am getting.

self._sslobj.do_handshake()
ssl.SSLError: [SSL: TLSV1_ALERT_DECODE_ERROR] tlsv1 alert decode error (_ssl.c:600)

Any help is appreciated.

+4
source share
1 answer

, Python, yagmail. : , , !

: , :

import yagmail
yag = yagmail.SMTP('username', 'password') # possibly host and port arguments
yag.send(to_addrs, contents = msg)

yagmail :

pip install yagmail  # python 2
pip3 install yagmail # python 3

html/images , !

, .

+1

All Articles