This repository has been archived by the owner on Jul 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
96 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,97 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Send email" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"with open(\"erty.txt\", \"w\") as f : f.write(\"try.try.try\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import pymmails" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"server = pymmails.create_smtp_server(\"gmail\", \"xavier.somebody@gmail.com\", \"pwd\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"In fonction create_smtp_server, the string ``gmail`` is replaced by ``smtp.gmail.com:567`` (tls version). By default, the server cannot be accessed unless IMAP is enabled (see [Problems sending mail with POP or IMAP](https://support.google.com/mail/answer/78775)). You can usually find this string by searching on internet for ``your provider smtp server``, you find pages such as [configuration des serveurs sortants et entrants des principaux comptes mails](http://assistance.orange.fr/configuration-des-serveurs-sortants-et-entrants-des-principaux-comptes-mails-1222.php). However, by doing this, you need to send your password. You should remove your password wherever it appears as soon as you don't need it anymore. If you forget, I advise you to change it." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"pymmails.send_email(server, \"xavier.somebody@gmail.com\", \"xavier.somebodyelse@else.com\",\n", | ||
" \"results\", \"body\", attachements = [ \"erty.txt\" ])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [ | ||
"cells": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"(221, b'2.0.0 closing connection e18sm17176289wjz.27 - gsmtp')" | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Send email" | ||
] | ||
}, | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"with open(\"erty.txt\", \"w\") as f : f.write(\"try.try.try\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import pymmails" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"server = pymmails.create_smtp_server(\"gmail\", \"xavier.somebody@gmail.com\", \"pwd\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"In fonction create_smtp_server, the string ``gmail`` is replaced by ``smtp.gmail.com:567`` (tls version). By default, the server cannot be accessed unless IMAP is enabled (see [Problems sending mail with POP or IMAP](https://support.google.com/mail/answer/78775)). You can usually find this string by searching on internet for ``your provider smtp server``, you find pages such as [configuration des serveurs sortants et entrants des principaux comptes mails](http://assistance.orange.fr/configuration-des-serveurs-sortants-et-entrants-des-principaux-comptes-mails-1222.php). However, by doing this, you need to send your password. You should remove your password wherever it appears as soon as you don't need it anymore. If you forget, I advise you to change it." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"pymmails.send_email(server, \"xavier.somebody@gmail.com\", \"xavier.somebodyelse@else.com\",\n", | ||
" \"results\", \"body\", attachements = [ \"erty.txt\" ])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"(221, b'2.0.0 closing connection e18sm17176289wjz.27 - gsmtp')" | ||
] | ||
}, | ||
"execution_count": null, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"server.quit()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"source": [ | ||
"server.quit()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": {}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
], | ||
"metadata": {}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters