質問編集履歴

1

コードの挿入やり直し

2021/08/31 12:46

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,6 @@
1
1
  ### 下記内容のコードを打つとエラーがでます```Python
2
+
3
+ ```Python
2
4
 
3
5
  import datetime
4
6
 
@@ -59,3 +61,115 @@
59
61
  server.close()
60
62
 
61
63
  print('送信完了')
64
+
65
+
66
+
67
+ ---------------------------------------------------------------------------
68
+
69
+ TimeoutError Traceback (most recent call last)
70
+
71
+ <ipython-input-20-237a61c6c7c5> in <module>
72
+
73
+ ----> 1 server = smtplib.SMTP_SSL('smtp.gmail.com', 456,context=ssl.create_default_context())
74
+
75
+ 2 server.login(gail_account, gmail_password)
76
+
77
+ 3 server.send_message(msg)
78
+
79
+ 4 server.close()
80
+
81
+ 5 print('送信完了')
82
+
83
+
84
+
85
+ ~\anaconda3\lib\smtplib.py in __init__(self, host, port, local_hostname, keyfile, certfile, timeout, source_address, context)
86
+
87
+ 1030 keyfile=keyfile)
88
+
89
+ 1031 self.context = context
90
+
91
+ -> 1032 SMTP.__init__(self, host, port, local_hostname, timeout,
92
+
93
+ 1033 source_address)
94
+
95
+ 1034
96
+
97
+
98
+
99
+ ~\anaconda3\lib\smtplib.py in __init__(self, host, port, local_hostname, timeout, source_address)
100
+
101
+ 251
102
+
103
+ 252 if host:
104
+
105
+ --> 253 (code, msg) = self.connect(host, port)
106
+
107
+ 254 if code != 220:
108
+
109
+ 255 self.close()
110
+
111
+
112
+
113
+ ~\anaconda3\lib\smtplib.py in connect(self, host, port, source_address)
114
+
115
+ 335 port = self.default_port
116
+
117
+ 336 sys.audit("smtplib.connect", self, host, port)
118
+
119
+ --> 337 self.sock = self._get_socket(host, port, self.timeout)
120
+
121
+ 338 self.file = None
122
+
123
+ 339 (code, msg) = self.getreply()
124
+
125
+
126
+
127
+ ~\anaconda3\lib\smtplib.py in _get_socket(self, host, port, timeout)
128
+
129
+ 1036 if self.debuglevel > 0:
130
+
131
+ 1037 self._print_debug('connect:', (host, port))
132
+
133
+ -> 1038 new_socket = socket.create_connection((host, port), timeout,
134
+
135
+ 1039 self.source_address)
136
+
137
+ 1040 new_socket = self.context.wrap_socket(new_socket,
138
+
139
+
140
+
141
+ ~\anaconda3\lib\socket.py in create_connection(address, timeout, source_address)
142
+
143
+ 806 if err is not None:
144
+
145
+ 807 try:
146
+
147
+ --> 808 raise err
148
+
149
+ 809 finally:
150
+
151
+ 810 # Break explicitly a reference cycle
152
+
153
+
154
+
155
+ ~\anaconda3\lib\socket.py in create_connection(address, timeout, source_address)
156
+
157
+ 794 if source_address:
158
+
159
+ 795 sock.bind(source_address)
160
+
161
+ --> 796 sock.connect(sa)
162
+
163
+ 797 # Break explicitly a reference cycle
164
+
165
+ 798 err = None
166
+
167
+
168
+
169
+ TimeoutError: [WinError 10060] 接続済みの呼び出し先が一定の時間を過ぎても正しく応答しなかったため、接続できませんでした。または接続済みのホストが応答しなかったため、確立された接続は失敗しました。
170
+
171
+ ```
172
+
173
+
174
+
175
+ このエラーの解決方法を教えていただけませんでしょうか。