|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.EricNetwork.EricGoogleMail</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.EricNetwork.EricGoogleMail</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing a dialog to send bug reports. |
|
13 </p> |
|
14 <h3>Global Attributes</h3> |
|
15 |
|
16 <table> |
|
17 <tr><td>None</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 |
|
21 <table> |
|
22 |
|
23 <tr> |
|
24 <td><a href="#EricGoogleMail">EricGoogleMail</a></td> |
|
25 <td>Class implementing the logic to send emails via Google Mail.</td> |
|
26 </tr> |
|
27 <tr> |
|
28 <td><a href="#EricGoogleMailAuthBrowser">EricGoogleMailAuthBrowser</a></td> |
|
29 <td>Class implementing a simple web browser to perform the OAuth2 authentication process.</td> |
|
30 </tr> |
|
31 </table> |
|
32 <h3>Functions</h3> |
|
33 |
|
34 <table> |
|
35 |
|
36 <tr> |
|
37 <td><a href="#GoogleMailHelp">GoogleMailHelp</a></td> |
|
38 <td>Module function to get some help about how to enable the Google Mail OAuth2 service.</td> |
|
39 </tr> |
|
40 </table> |
|
41 <hr /> |
|
42 <hr /> |
|
43 <a NAME="EricGoogleMail" ID="EricGoogleMail"></a> |
|
44 <h2>EricGoogleMail</h2> |
|
45 |
|
46 <p> |
|
47 Class implementing the logic to send emails via Google Mail. |
|
48 </p> |
|
49 <h3>Signals</h3> |
|
50 <dl> |
|
51 |
|
52 <dt>sendResult(bool, str)</dt> |
|
53 <dd> |
|
54 emitted to indicate the transmission result |
|
55 and a result message |
|
56 </dd> |
|
57 </dl> |
|
58 <h3>Derived from</h3> |
|
59 QObject |
|
60 <h3>Class Attributes</h3> |
|
61 |
|
62 <table> |
|
63 <tr><td>None</td></tr> |
|
64 </table> |
|
65 <h3>Class Methods</h3> |
|
66 |
|
67 <table> |
|
68 <tr><td>None</td></tr> |
|
69 </table> |
|
70 <h3>Methods</h3> |
|
71 |
|
72 <table> |
|
73 |
|
74 <tr> |
|
75 <td><a href="#EricGoogleMail.__init__">EricGoogleMail</a></td> |
|
76 <td>Constructor</td> |
|
77 </tr> |
|
78 <tr> |
|
79 <td><a href="#EricGoogleMail.__credentialsFromSession">__credentialsFromSession</a></td> |
|
80 <td>Private method to create a credentials object.</td> |
|
81 </tr> |
|
82 <tr> |
|
83 <td><a href="#EricGoogleMail.__doSendMessages">__doSendMessages</a></td> |
|
84 <td>Private method to send all queued messages.</td> |
|
85 </tr> |
|
86 <tr> |
|
87 <td><a href="#EricGoogleMail.__loadToken">__loadToken</a></td> |
|
88 <td>Private method to load a token from the token file.</td> |
|
89 </tr> |
|
90 <tr> |
|
91 <td><a href="#EricGoogleMail.__prepareMessage">__prepareMessage</a></td> |
|
92 <td>Private method to prepare the message for sending.</td> |
|
93 </tr> |
|
94 <tr> |
|
95 <td><a href="#EricGoogleMail.__processAuthorization">__processAuthorization</a></td> |
|
96 <td>Private slot to process the received authorization code.</td> |
|
97 </tr> |
|
98 <tr> |
|
99 <td><a href="#EricGoogleMail.__saveToken">__saveToken</a></td> |
|
100 <td>Private method to save a token to the token file.</td> |
|
101 </tr> |
|
102 <tr> |
|
103 <td><a href="#EricGoogleMail.__startSession">__startSession</a></td> |
|
104 <td>Private method to start an authorized session and optionally start the authorization flow.</td> |
|
105 </tr> |
|
106 <tr> |
|
107 <td><a href="#EricGoogleMail.sendMessage">sendMessage</a></td> |
|
108 <td>Public method to send a message via Google Mail.</td> |
|
109 </tr> |
|
110 </table> |
|
111 <h3>Static Methods</h3> |
|
112 |
|
113 <table> |
|
114 <tr><td>None</td></tr> |
|
115 </table> |
|
116 |
|
117 <a NAME="EricGoogleMail.__init__" ID="EricGoogleMail.__init__"></a> |
|
118 <h4>EricGoogleMail (Constructor)</h4> |
|
119 <b>EricGoogleMail</b>(<i>parent=None</i>) |
|
120 |
|
121 <p> |
|
122 Constructor |
|
123 </p> |
|
124 <dl> |
|
125 |
|
126 <dt><i>parent</i> (QObject)</dt> |
|
127 <dd> |
|
128 reference to the parent object |
|
129 </dd> |
|
130 </dl> |
|
131 <a NAME="EricGoogleMail.__credentialsFromSession" ID="EricGoogleMail.__credentialsFromSession"></a> |
|
132 <h4>EricGoogleMail.__credentialsFromSession</h4> |
|
133 <b>__credentialsFromSession</b>(<i></i>) |
|
134 |
|
135 <p> |
|
136 Private method to create a credentials object. |
|
137 </p> |
|
138 <dl> |
|
139 <dt>Return:</dt> |
|
140 <dd> |
|
141 created credentials object |
|
142 </dd> |
|
143 </dl> |
|
144 <dl> |
|
145 <dt>Return Type:</dt> |
|
146 <dd> |
|
147 google.oauth2.credentials.Credentials |
|
148 </dd> |
|
149 </dl> |
|
150 <a NAME="EricGoogleMail.__doSendMessages" ID="EricGoogleMail.__doSendMessages"></a> |
|
151 <h4>EricGoogleMail.__doSendMessages</h4> |
|
152 <b>__doSendMessages</b>(<i></i>) |
|
153 |
|
154 <p> |
|
155 Private method to send all queued messages. |
|
156 </p> |
|
157 <a NAME="EricGoogleMail.__loadToken" ID="EricGoogleMail.__loadToken"></a> |
|
158 <h4>EricGoogleMail.__loadToken</h4> |
|
159 <b>__loadToken</b>(<i></i>) |
|
160 |
|
161 <p> |
|
162 Private method to load a token from the token file. |
|
163 </p> |
|
164 <dl> |
|
165 <dt>Return:</dt> |
|
166 <dd> |
|
167 loaded token |
|
168 </dd> |
|
169 </dl> |
|
170 <dl> |
|
171 <dt>Return Type:</dt> |
|
172 <dd> |
|
173 dict or None |
|
174 </dd> |
|
175 </dl> |
|
176 <a NAME="EricGoogleMail.__prepareMessage" ID="EricGoogleMail.__prepareMessage"></a> |
|
177 <h4>EricGoogleMail.__prepareMessage</h4> |
|
178 <b>__prepareMessage</b>(<i>message</i>) |
|
179 |
|
180 <p> |
|
181 Private method to prepare the message for sending. |
|
182 </p> |
|
183 <dl> |
|
184 |
|
185 <dt><i>message</i> (email.mime.text.MIMEBase)</dt> |
|
186 <dd> |
|
187 message to be prepared |
|
188 </dd> |
|
189 </dl> |
|
190 <dl> |
|
191 <dt>Return:</dt> |
|
192 <dd> |
|
193 prepared message dictionary |
|
194 </dd> |
|
195 </dl> |
|
196 <dl> |
|
197 <dt>Return Type:</dt> |
|
198 <dd> |
|
199 dict |
|
200 </dd> |
|
201 </dl> |
|
202 <a NAME="EricGoogleMail.__processAuthorization" ID="EricGoogleMail.__processAuthorization"></a> |
|
203 <h4>EricGoogleMail.__processAuthorization</h4> |
|
204 <b>__processAuthorization</b>(<i>authCode</i>) |
|
205 |
|
206 <p> |
|
207 Private slot to process the received authorization code. |
|
208 </p> |
|
209 <dl> |
|
210 |
|
211 <dt><i>authCode</i> (str)</dt> |
|
212 <dd> |
|
213 received authorization code |
|
214 </dd> |
|
215 </dl> |
|
216 <a NAME="EricGoogleMail.__saveToken" ID="EricGoogleMail.__saveToken"></a> |
|
217 <h4>EricGoogleMail.__saveToken</h4> |
|
218 <b>__saveToken</b>(<i>token</i>) |
|
219 |
|
220 <p> |
|
221 Private method to save a token to the token file. |
|
222 </p> |
|
223 <dl> |
|
224 |
|
225 <dt><i>token</i> (dict)</dt> |
|
226 <dd> |
|
227 token to be saved |
|
228 </dd> |
|
229 </dl> |
|
230 <a NAME="EricGoogleMail.__startSession" ID="EricGoogleMail.__startSession"></a> |
|
231 <h4>EricGoogleMail.__startSession</h4> |
|
232 <b>__startSession</b>(<i></i>) |
|
233 |
|
234 <p> |
|
235 Private method to start an authorized session and optionally start the |
|
236 authorization flow. |
|
237 </p> |
|
238 <a NAME="EricGoogleMail.sendMessage" ID="EricGoogleMail.sendMessage"></a> |
|
239 <h4>EricGoogleMail.sendMessage</h4> |
|
240 <b>sendMessage</b>(<i>message</i>) |
|
241 |
|
242 <p> |
|
243 Public method to send a message via Google Mail. |
|
244 </p> |
|
245 <dl> |
|
246 |
|
247 <dt><i>message</i> (email.mime.text.MIMEBase)</dt> |
|
248 <dd> |
|
249 email message to be sent |
|
250 </dd> |
|
251 </dl> |
|
252 <div align="right"><a href="#top">Up</a></div> |
|
253 <hr /> |
|
254 <hr /> |
|
255 <a NAME="EricGoogleMailAuthBrowser" ID="EricGoogleMailAuthBrowser"></a> |
|
256 <h2>EricGoogleMailAuthBrowser</h2> |
|
257 |
|
258 <p> |
|
259 Class implementing a simple web browser to perform the OAuth2 |
|
260 authentication process. |
|
261 </p> |
|
262 <h3>Signals</h3> |
|
263 <dl> |
|
264 |
|
265 <dt>approvalCodeReceived(str)</dt> |
|
266 <dd> |
|
267 emitted to indicate the receipt of the |
|
268 approval code |
|
269 </dd> |
|
270 </dl> |
|
271 <h3>Derived from</h3> |
|
272 QDialog |
|
273 <h3>Class Attributes</h3> |
|
274 |
|
275 <table> |
|
276 <tr><td>None</td></tr> |
|
277 </table> |
|
278 <h3>Class Methods</h3> |
|
279 |
|
280 <table> |
|
281 <tr><td>None</td></tr> |
|
282 </table> |
|
283 <h3>Methods</h3> |
|
284 |
|
285 <table> |
|
286 |
|
287 <tr> |
|
288 <td><a href="#EricGoogleMailAuthBrowser.__init__">EricGoogleMailAuthBrowser</a></td> |
|
289 <td>Constructor</td> |
|
290 </tr> |
|
291 <tr> |
|
292 <td><a href="#EricGoogleMailAuthBrowser.__pageLoadFinished">__pageLoadFinished</a></td> |
|
293 <td>Private slot handling the loadFinished signal.</td> |
|
294 </tr> |
|
295 <tr> |
|
296 <td><a href="#EricGoogleMailAuthBrowser.__titleChanged">__titleChanged</a></td> |
|
297 <td>Private slot handling changes of the web page title.</td> |
|
298 </tr> |
|
299 <tr> |
|
300 <td><a href="#EricGoogleMailAuthBrowser.load">load</a></td> |
|
301 <td>Public method to start the authorization flow by loading the given URL.</td> |
|
302 </tr> |
|
303 </table> |
|
304 <h3>Static Methods</h3> |
|
305 |
|
306 <table> |
|
307 <tr><td>None</td></tr> |
|
308 </table> |
|
309 |
|
310 <a NAME="EricGoogleMailAuthBrowser.__init__" ID="EricGoogleMailAuthBrowser.__init__"></a> |
|
311 <h4>EricGoogleMailAuthBrowser (Constructor)</h4> |
|
312 <b>EricGoogleMailAuthBrowser</b>(<i>parent=None</i>) |
|
313 |
|
314 <p> |
|
315 Constructor |
|
316 </p> |
|
317 <dl> |
|
318 |
|
319 <dt><i>parent</i> (QWidget)</dt> |
|
320 <dd> |
|
321 reference to the parent widget |
|
322 </dd> |
|
323 </dl> |
|
324 <a NAME="EricGoogleMailAuthBrowser.__pageLoadFinished" ID="EricGoogleMailAuthBrowser.__pageLoadFinished"></a> |
|
325 <h4>EricGoogleMailAuthBrowser.__pageLoadFinished</h4> |
|
326 <b>__pageLoadFinished</b>(<i></i>) |
|
327 |
|
328 <p> |
|
329 Private slot handling the loadFinished signal. |
|
330 </p> |
|
331 <a NAME="EricGoogleMailAuthBrowser.__titleChanged" ID="EricGoogleMailAuthBrowser.__titleChanged"></a> |
|
332 <h4>EricGoogleMailAuthBrowser.__titleChanged</h4> |
|
333 <b>__titleChanged</b>(<i>title</i>) |
|
334 |
|
335 <p> |
|
336 Private slot handling changes of the web page title. |
|
337 </p> |
|
338 <dl> |
|
339 |
|
340 <dt><i>title</i> (str)</dt> |
|
341 <dd> |
|
342 web page title |
|
343 </dd> |
|
344 </dl> |
|
345 <a NAME="EricGoogleMailAuthBrowser.load" ID="EricGoogleMailAuthBrowser.load"></a> |
|
346 <h4>EricGoogleMailAuthBrowser.load</h4> |
|
347 <b>load</b>(<i>url</i>) |
|
348 |
|
349 <p> |
|
350 Public method to start the authorization flow by loading the given URL. |
|
351 </p> |
|
352 <dl> |
|
353 |
|
354 <dt><i>url</i> (str or QUrl)</dt> |
|
355 <dd> |
|
356 URL to be laoded |
|
357 </dd> |
|
358 </dl> |
|
359 <div align="right"><a href="#top">Up</a></div> |
|
360 <hr /> |
|
361 <hr /> |
|
362 <a NAME="GoogleMailHelp" ID="GoogleMailHelp"></a> |
|
363 <h2>GoogleMailHelp</h2> |
|
364 <b>GoogleMailHelp</b>(<i></i>) |
|
365 |
|
366 <p> |
|
367 Module function to get some help about how to enable the Google Mail |
|
368 OAuth2 service. |
|
369 </p> |
|
370 <dl> |
|
371 <dt>Return:</dt> |
|
372 <dd> |
|
373 help text |
|
374 </dd> |
|
375 </dl> |
|
376 <dl> |
|
377 <dt>Return Type:</dt> |
|
378 <dd> |
|
379 str |
|
380 </dd> |
|
381 </dl> |
|
382 <div align="right"><a href="#top">Up</a></div> |
|
383 <hr /> |
|
384 </body></html> |