Closed yunpengb closed 6 years ago
how to change smtp port on another smtp mail server? now i am using
yag = yagmail.SMTP( user="myid", password="myword", host='smtp.green.com') to = 'bbb@green.com' subject = 'test subject' body = 'test body' html = '<a href="https://pypi.python.org/pypi/sky/">Click me!</a>' img = '1.png' yag.send(to = to, subject = subject, contents = [body, html, img])
can not work now, i am thinking maybe i need define smtp port. error information is:
yag.send(to = to, subject = subject, contents = [body, html, img]) File "C:\Python27\lib\site-packages\yagmail\sender.py", line 144, in send self.login() File "C:\Python27\lib\site-packages\yagmail\sender.py", line 243, in login self._login(self.credentials) File "C:\Python27\lib\site-packages\yagmail\sender.py", line 189, in _login self.smtp = self.connection(self.host, self.port, **self.kwargs) File "C:\Python27\lib\smtplib.py", line 802, in __init__ SMTP.__init__(self, host, port, local_hostname, timeout) File "C:\Python27\lib\smtplib.py", line 256, in __init__ (code, msg) = self.connect(host, port) File "C:\Python27\lib\smtplib.py", line 317, in connect self.sock = self._get_socket(host, port, self.timeout) File "C:\Python27\lib\smtplib.py", line 807, in _get_socket new_socket = socket.create_connection((host, port), timeout) File "C:\Python27\lib\socket.py", line 575, in create_connection raise err socket.error: [Errno 10060]
yag = yagmail.SMTP( user="myid", password="myword", host='smtp.green.com',port=25) got it
how to change smtp port on another smtp mail server? now i am using
can not work now, i am thinking maybe i need define smtp port. error information is: