Last active
March 26, 2022 13:09
-
-
Save devenes/9b45408161b367f7a7bd38ca855fa183 to your computer and use it in GitHub Desktop.
The goal here is to make it as simple and painless as possible to send emails.
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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"source": [ | |
"#importing the Yagmail library\r\n", | |
"import yagmail" | |
], | |
"outputs": [], | |
"metadata": {} | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"source": [ | |
"\r\n", | |
"\r\n", | |
"try:\r\n", | |
" #initializing the server connection\r\n", | |
" yag = yagmail.SMTP(user='example@gmail.com', password='Passwrod1234!')\r\n", | |
" #sending the email\r\n", | |
" yag.send(to='kazoum@label.ma', cc = 'mehdi@gmail.com', subject='Testing Yagmail', contents='It worked!', attachments=['inputs/CV_Dev_Enes.pdf', 'inputs/Recommandation Enes Turan.pdf'])\r\n", | |
" print(\"Email sent successfully\")\r\n", | |
" \r\n", | |
"except:\r\n", | |
" print(\"Error, email was not sent\")" | |
], | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"Email sent successfully\n" | |
] | |
} | |
], | |
"metadata": {} | |
} | |
], | |
"metadata": { | |
"orig_nbformat": 4, | |
"language_info": { | |
"name": "python", | |
"version": "3.8.10", | |
"mimetype": "text/x-python", | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"pygments_lexer": "ipython3", | |
"nbconvert_exporter": "python", | |
"file_extension": ".py" | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3.8.10 64-bit ('Projects': conda)" | |
}, | |
"interpreter": { | |
"hash": "c8faec805a12d1b663380d2dace406fb2ecba7e4bc3572c56e84db7a46283368" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment