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